1

I'm trying to create a new XTS object for a set of intraday FX data. The initial dataframe is called "one_day_series" and looks like this:

      pair    id         date_time                bid     ask      mid_price
1   USDCAD 485194239    2009-08-03 08:00:00.451 1.07679 1.07699 1.07689

The command I use to create an XTS object is as follows:

my_xts <- xts(one_day_series[,6], as.POSIXct(strptime(one_day_series[,3], "%Y-%m-%d %H:%M:%S")))

I get an XTS object out of this however the time has been reset to 00:00:02, an example:

     row.names            V1
1   2009-08-03 00:00:02 1.07591

I just want the time to be created correctly from the dataframe so I would be grateful if someone could help me understand what is going wrong here ?

Julien Roncaglia
  • 17,397
  • 4
  • 57
  • 75
AVSG
  • 23
  • 2
  • 1
    Please provide a [reproducible example](http://stackoverflow.com/q/5963269/271616). Also, you say you get an xts object with a different time, but the output you show is a data.frame, not an xts object. – Joshua Ulrich Aug 04 '15 at 22:38
  • Thanks for get back. I figured out what I was doing wrong. – AVSG Aug 08 '15 at 21:07

0 Answers0