The strategy in abstract form is simple. There are two equities ZOO and POO and I want to test 30 minute bar data.
Let X be the difference in price of POO and ZOO at a given time.
The trading order is going long ZOO and POO in an A:B ratio.
Let C be the cost of that order while ignoring market impact and only considering predicatable costs.
If X > C for the Slice :
execute the trade of going long POO and ZOO in an A:B ratio.
If X = 0
Liquidiate net position.
Close all positions at market close.
Other things:
In the future, I intend to backtest this strategy comparing ZOO to a basket of POO's where the A:B ratio of the order depends on what POO actually is.
In my mind this is a toy example of pairs trading, so I imagine this is extremely simple to implementm, but I am having a hard understanding which modules I need to tweak and custom build.
Thanks in advance to anyone who even read all of this!
Best,
Roman
Erik Bengtson
If I understand well your strategy is mean reversion of two stocks pairs, here some examples that you can use
https://www.quantconnect.com/tutorials/strategy-library/pairs-trading-copula-vs-cointegration
https://www.quantconnect.com/tutorials/strategy-library/trading-with-wti-brent-spread
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!