This is really more of a warning, but I do ask and answer a question. When the to
date parameter is specified in getSymbols
, tq_get
, getSymbols
, the function returns prices for the dates up to but not including the to date even though the documentation (quantmod::getSymbols.yahoo
) states it will "Retrieve data through this date". Consider the following example taken from a tidyquant vignette:
Ra <- c("AAPL", "GOOG", "NFLX") %>%
tq_get(get = "stock.prices",
from = "2010-01-01",
to = "2015-12-31")
One might expect the result to include prices for 2015-12-31, but it only returns prices through 2015-12-30. There are prices for the 31st; the market was open and the prices can be viewed on yahoo finance.
Documentation, such as the tidyquant vignette, frequently shows the result only of the head function, so this is an easy detail to miss. If in this example, you wanted performance for 2015, you'd be missing a day.
So for the question: How do I get these functions to return prices up to and including the to
date parameter?