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 ?