Hi,
I've been playing with a slightly modified version of the example for PearsonCorrelationPairsTradingAlphaModel. (I added the possibility of selecting only assets with a specific MorningstarSectorCode via a fine filter).
In Backtesting as well as paper trading, I noticed that the Alpha model seems to have created insights that closed only the short half of the pair, whilst keeping the long side open. In the attached backtest for example the RTX short closed on 28/07 with the BA long kept open. So I've been wondering if this is how the algorithm is supposed to work - wouldn't a classical stat arb algo always open and close pairs in synch and thus always have an equal and opposite short/long position?
I haven't looked at the PearsonCorrelationPairsTradingAlphaModel class in any detail, so my apologies if this is a daft question.
Lucas
Hi Lars
Yeah, the problem is mainly that the universe selection and PCM does not play well together.
When one symbol of the pair is removed from the universe, it is removed. Because that the other leg is not removed, it is still open. Furthermore, when 2 insights of the same symbol is sent, the last insight is being executed and the first is removed and not accounted for. This can be a problem when you have pairs that are crosses eachother. Like AAPL-MSFT, MSFT-GOOG. Here MSFT can be both long and short, but will properly only be long or short, not both. This is something that I have tried to circumvent with a costom PCM, but it gets quite complicated in the long run. If you want the script, you contact me on discord (oikoikoik14)
Have a good day
Lucas
Lars Klawitter
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!