XTS: split FX intraday bar data by trading days
I want to apply a function to 20 trading days worth of hourly FX data (as one example amongst many). I started off with rollapply(data,width=20*24,FUN=FUN,by=24) . That seemed to be working well, I could even assert I always got 480 bars passed in... until I realized that wasn't what I wanted. The start and end time of those 480 bars was drifting over the years, due to changes in daylight savings, and market holidays. So, what I want is a function that treats a day as from 22:00 to 22:00 of each day we have data for. (21:00 to 21:00 in N.Y. summertime - my data timezone is UTC, and daystart is