I have minutely data that I wish to convert to daily. I can do this using to.daily
without issue.
x = to.daily(x, index=to.daily(x, indexAt="endof", drop.time=FALSE, OHLC=TRUE)
> head(x)
x.Open x.High x.Low x.Close x.Volume
2007-01-05 23:59:00 1774.50 1813.50 1769.75 1803.50 963
2007-01-06 07:15:00 1803.50 1803.75 1782.75 1794.25 436
2007-01-08 23:59:00 1795.00 1800.25 1794.75 1799.75 284
2007-01-09 23:58:00 1799.75 1809.25 1789.25 1805.25 771
2007-01-10 23:59:00 1805.25 1815.75 1789.00 1800.50 1027
2007-01-11 23:59:00 1800.75 1836.00 1795.00 1830.25 962
The problem is for the instrument I am looking at the start of the day is 07:30 and the end of the day is 07:15. So it opens at 7:30am trades to 7:15am the next day and closes for 15min then opens again.
I have tried using to.period
and then change the endpoints but cannot seem to get it working.
How can I change the minutely data to daily with 7:30am being the open time and 7:15am be the close?