Error in downloading data from both BatchGetSymbols and quantmod

Hello all. I have used both BatchGetSymbols and quantmod to download data for the ticker SPY for awhile and periodically there is some aberration in the date format which results in the error "Error in charToDate(x):character string is not in a standard unambiguous format.

...
#R
getSymbols("SPY",from = "01/01/2010", to = "12/31/2018",auto.assign = TRUE)
...
Can anyone offer a suggestion for trapping date errors in the source file?

Thanks

Jim

I'm not familiar with those packages but is always a good idea to use this more standard date format YYYY-MM-DD or using lubridate functions like mdy("01/01/2010")

Hi Jim.

I've used quantmod for quite a while. The issue you describe is almost always generated when the data service you're querying either rate limits the data, or somehow can't fulfill the request. Occasionally, too, I'll get an unusual entry in a particular row in the column I'm working with (mostly when I query crowd-currated data that has an unusually formatted data entry). I see you're using getSymbols() there with the default data source (Yahoo). Try waiting 60 seconds and re-issuing the command to try and reproduce the result. If you get the same error message, and its not between 4pm - 5pm ET then its a data formatting problem. Otherwise, it was probably a Yahoo data serving problem. In that case, I'd call Yahoo customer service asn ask for your subscription price to be refunded :wink:

Hope that helps,
Dwayne

1 Like

I followed your advice and waited, The problem resolved itself. I believe the data source is the issue.

Thanks for your feedback.

Jim

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.