GetSymbols (quantmod) giving incorrect dates

I use the quantmod package to retrieve stock data. Code

Data = getSymbols('LON:ADN',src="google",auto.assign=FALSE, from = '2011-08-10') 

The results in the xts, as expected, but upon closer inspection, it shows the trading volume on 2012-10-21 (October 21), which was on Sunday, and therefore clearly erroneous. Other other Sundays are also included. Unfortunately, weekend-related errors appear to have squeezed the rest of the data out of alignment.

Has anyone encountered similar problems getting tickers with quantum before, and if so, do they know about it?

thanks

+4
source share
1 answer

As you mentioned in the comments, this seems like a xts issue, possibly due to converting the POSIX date to the xts function (see this answer ).

I can reproduce the problem in a new R session when Sys.getenv("TZ") is an empty string of characters. Setting the time zone for any valid time zone (not for all tested), for example, "America/Chicago" gives the expected dates, that is, there are no Sundays:

In the new session (December 16, 2012 was Sunday):

 Sys.getenv("TZ") # [1] "" library(quantmod) Data <- getSymbols('LON:ADN',src="google",auto.assign=FALSE, from = '2011-08-10') tail(index(Data)) # [1] "2012-12-13" "2012-12-16" "2012-12-17" "2012-12-18" "2012-12-19" "2012-12-20" 

Then change the time zone

 Sys.setenv(TZ="America/Chicago") Data <- getSymbols('LON:ADN',src="google",auto.assign=FALSE, from = '2011-08-10') tail(index(Data)) # [1] "2012-12-14" "2012-12-17" "2012-12-18" "2012-12-19" "2012-12-20" "2012-12-21" 

No Sundays.

+3
source

All Articles