I keep getting an error when trying to extract data for google sources using getSymbols()
.
Essentially, the dates of 2003 December 28-30 are "missing", and it then defaults the minimum date to 2001, as opposed to the minimum date that I am specifying.
Is there a way around this error so I may correctly and completely pull the data from google as the source for my getSymbols
function?
Please see my code below:
install.packages("quantmod")
library(quantmod)
ticks <- c("XLF", "XLK")
getSymbols(ticks, src = "google",
from = as.Date("1999-12-01"), to = as.Date("2017-05-11"))
Below is the warning message that I receive:
Warning message: In getSymbols.google(Symbols = c("XLF", "XLK"), env = , : google duplicate bug - missing Dec 28,29,30 of 2003
This isn't related to the warning about duplicates. Rather, it appears that Google Finance is limiting the number of observations you can download at a time to ~4000.
This happens if you go to their historical prices page for XLF, select a date range larger than 4000 days, and click the Download to spreadsheet link.
For now, you can work-around this by making multiple calls to getSymbols
that are each for less than 4000 days of history, then combining the results.
Something like:
from <- "1999-12-01"
to <- "2017-05-11"
for (tick in ticks) {
one <- getSymbols(tick, src = "google", from = from, to = "2010-12-31", auto.assign = FALSE)
two <- getSymbols(tick, src = "google", from = "2011-01-01", to = to, auto.assign = FALSE)
assign(tick, rbind(one, two))
}