tests/testthat/test-prices.R

test_that("prices", {

  # test relies on calling api (we skip it on cran to save network bandwith)
  skip_if_offline()
  skip_on_cran() # too heavy for cran

  suppressMessages({
    set_token()

    df_prices1 <- get_prices(
      ticker = "AAPL",
      exchange = "US"
      )

    expect_true(nrow(df_prices1) > 0)

    # run it again for testing local cache
    df_prices2 <- get_prices(
      ticker = "AAPL",
      exchange = "US"
    )

    expect_true(identical(df_prices2, df_prices2))


  })
})

Try the eodhdR2 package in your browser

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

eodhdR2 documentation built on Sept. 13, 2024, 1:07 a.m.