Quantstrat pair trade
See attached for an example of a pair trade in quantstrat using a single portfolio and custom order sizing function.
On Mon, May 9, 2011 at 5:30 AM, Brian G. Peterson <brian at braverock.com>wrote:
On Sun, 2011-05-08 at 13:46 -0500, G See wrote:
Thank you Brian. That was extremely helpful. It now runs, and I think it does what I wanted it to do.
Thank you! This is a much cleaner example of how you can extend existing functionality without having to extensively rewrite the infrastructure! This version should probably go to algotr8der and to the list. It's much better than the first attempt.
I will probably make it a little more sophisticated with regard to order sizing and dividend accounting, but here's what I've got.
May I include this example in the quantstrat demos ? (credited to you, of course)
Of course. That's why I made it.
Incidentally, I am in the middle of changing function buildSpread (in FinancialInstrument) to allow for other spreading methods (there is an unexposed function that does this now), and will eventually add ratio calculator utility functions too. Regards, - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
Garrett -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110509/3cd802c0/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: quantstrat_pair_trade_3.r Type: application/octet-stream Size: 8357 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110509/3cd802c0/attachment.obj>