[R-SIG-Finance] quantstrat with intraday data

Jim Green student.northwestern at gmail.com
Wed May 2 06:00:12 CEST 2012


Greetings!
Pls forgive me if this is an old topic. I have searched through list
archives extensively but I am just not sure if I am using quantstrat
correctly with intraday data.

I've attached sample minute ohlc data. after loading it, an xts object
spy.test would be populated as shown below:

> nrow(spy.test)
[1] 1074
> head(spy.test)
                    spy.Open spy.High spy.Low spy.Close spy.Volume
2012-03-29 07:32:00   140.14   140.15  140.14    140.15        800
2012-03-29 07:33:00   140.15   140.15  140.14    140.14       2700
2012-03-29 07:36:00   140.16   140.16  140.12    140.12       5105
2012-03-29 07:40:00   140.17   140.17  140.17    140.17        200
2012-03-29 07:41:00   140.15   140.16  140.15    140.16       1798
2012-03-29 07:42:00   140.16   140.16  140.16    140.16       2052
> tail(spy.test)
                    spy.Open spy.High spy.Low spy.Close spy.Volume
2012-03-30 16:26:00   140.86   140.87  140.85    140.87      10900
2012-03-30 16:27:00   140.86   140.86  140.79    140.79      27770
2012-03-30 16:28:00   140.84   140.86  140.84    140.86      20400
2012-03-30 16:29:00   140.85   140.86  140.84    140.86      18500
2012-03-30 16:30:00   140.86   140.86  140.85    140.85      11035
2012-03-30 16:31:00   140.85   140.86  140.85    140.85       1100


Currently I use something similar to attached test.R to do intraday
work. in the code I liquidate everything before close so that I don't
need to worry about splits and dividends. Is what I am doing the
correct way of using quantstrat with intraday data?

Also if in future I will hold overnight positions, How would I make
sure dividends and splits are correctly adjusted for pnl and summary
statistics? would underlying blotter be smart enough to handle all the
housekeeping?

Thanks!

Jim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spy.test.Rdata
Type: application/octet-stream
Size: 14694 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120502/2cddb991/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.R
Type: application/octet-stream
Size: 2994 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120502/2cddb991/attachment-0001.obj>


More information about the R-SIG-Finance mailing list