[R-SIG-Finance] quantstrat with intraday data

Brian G. Peterson brian at braverock.com
Wed May 2 15:02:54 CEST 2012


On Wed, 2012-05-02 at 00:00 -0400, Jim Green wrote:
> 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.
<...>
> 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?

That's certainly the easiest answer.

blotter contains some support for dividends, but it is only lightly
tested, since I personally don't need that functionality.  Additional
testing, direct feedback, and patches are always welcome.  Participation
by users is one of the ways these packages grow over time.  (and feel
free to take those conversations off-list)

> 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?

No Guarantees (of course that's true of everything in R).

My recollection is that the addDiv function will add cash to your
account to cover dividends.  

I don't believe that there is a function for splits.  You'd likely need
to write that, we'd love the contribution.  It shouldn't be hard, as all
that needs to happen is that you add a transaction for the split with a
price of zero, adding more shares and lowering your average cost to
compensate for the split.

As xts gains support for differing column classes this summer as part of
the funded GSoC project, it will get easier to add additional
information to transactions that will definitely include transaction
type.

Regards,

   - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list