Search code examples
rquantmodquantitative-finance

Quantmod getSymbols returns date and not time when import from CSV


When doing getSymbols from CSV i'm only getting dates, but no time. I have specified the date/time format, what am i doing wrong?

I'm running this command

 getSymbols(symbols, verbose=TRUE, src='csv', dir="~/trading/R/Data/",format="%Y%m%d %H%M%S", col.names=c("Open","High","Low","Close","Volume"))

and the format of my CSV is

20150302 130100,50.57,50.58,50.53,50.56,263
20150302 130200,50.57,50.64,50.56,50.62,219

if i look at the imported xts

           CL.Open CL.High CL.Low CL.Close CL.Volume
2015-03-02   50.57   50.64  50.56    50.62       219

No time?

Yet if i run this command on an existing dataframe (dtfrm)

as.xts(read.zoo(dtfrm, tz='', format='%Y%m%d %H%M%S'))

I get the time as expected.


Solution

  • As this is a current known issue, the workaround i'm doing is reading the CSV as a table then converting it to XTS.