tests/testthat/test-market-summary.R

if (requireNamespace("httptest", quietyly = TRUE)) {
  httptest::with_mock_api({
    test_that("output from market summary is as expected", {
      testthat::skip_on_cran()
      trend <- get_market_summary()
      expect_equal(length(trend[[1]]), 29)
      expect_equal(trend[[1]]$fullExchangeName, "CME")
      expect_equal(trend[[1]]$symbol, "ES=F")
      expect_equal(trend[[1]]$quoteType, "FUTURE")
      expect_equal(trend[[1]]$regularMarketPrice$raw, 4159.25)
    })
  })
}

Try the yahoofinancer package in your browser

Any scripts or data that you put into this service are public.

yahoofinancer documentation built on May 29, 2024, 2:30 a.m.