context("Get and adjust prices")
test_that("accepts defaults", {
o1 <- options("stringsAsFactors" = FALSE)
#o2 <- options("getSymbols.auto.assign" = FALSE)
#o3 <- options("getSymbols.warning4.0" = FALSE)
on.exit(options(o1), add=TRUE)
#on.exit(options(o2), add=TRUE)
#on.exit(options(o3), add=TRUE)
ticker <- "XLE"
get_and_adjust(c(ticker),init_date="2015-01-01",switch_date="2016-01-01")
# print(last(Cl(XLE)))
# print(last(Ad(XLE)))
# expect_equal(as.numeric(last(Cl(XLE))),as.numeric(last(Ad(XLE))))
# yahoo expect_equal( as.numeric(xts::last(Cl(XLE["2017-06-30",]))), 64.92 ) # for 2017-06-30 canned
expect_equal( as.numeric(xts::last(Cl(XLE["2017-06-30",]))), 63.7, tolerance=1e-1 ) # for 2017-06-30 canned
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.