I am managing to confuse myself with what I am seeing in the docs, and
results returned by Google, so I hope someone here can provide me a bit of
clarity.

 

I am working with tick data, from which  I have been constructing an xts
object with a datetime field and a price field, from which I then construct
one minute OHLC data.  I know I have to use zoo's function to interpolate
missing data (since there are a few minutes through the data when nothing
was traded, even for a high volume futures contract).

 

I want to use rollapply on daily data to apply my analysis to daily data
between 9:30AM EST and 4:30PM EST as that is when most of the trading of
these contracts happen, but there I sporadic trading of these contracts
outside those times which I would like to ignore.

 

I have found rollapply easy to use (and that is why I need zoo's
interpolation capability so it doesn't fail because of missing data), and
have seen apply.daily.

 

I thus expect I need two functions: 1) to do my analysis (already done and
working fine - this returns a data.frame with all the variables I require in
my output); 2) a function to invoke rollapply on a daily sample, and which I
can pass to apply.daily in order to get results for all the days for which I
have data.

 

What I don't know how to do is how to tell rollapply that it is to work only
on values with times between my start and end times, for whatever date's
data it happens to get, or how to combine the results for each day into a
single data.frame or zoo or xts object.

 

I guess my question amounts to how I can do this in R, with the capabilities
of zoo and/or xts, or do I have to resort to using a mix of SQL, Perl and R
to get it done (i.e. make a driver script in Perl that gets a day's worth of
data between the right times from my DB using SQL, and then passes that data
to  my R script).

 

Any enlightenment would be appreciated.

 

Thanks

 

Ted


	[[alternative HTML version deleted]]

