I've calculated the correlation coefficient on every possible stock pair in the S&P, and narrowed the list down to about 150 pairs with the cc I'm looking for.
Now I'd like to run backtests on every one of these pairs and compare the results. Is there a way to automate this in QC?
The backtest code to be used is attached, run on the pair DISH and UNM.
.ekz.
You could create an external parameter that determines which pair is being tested, then run an optimization to cycle through values 0-to-149 for that parameter.
I've done a quick example in the attached attached backtest, using 3 random pairs.
In case you're not familiar with how to run optimizations, I've attached some screen shots as a guide, i cycle through values 0-to-2 (here's a link to them in imgur in case they dont attach)
For more detailed guidance, you can also check out the very helpful video from the QC team here:
On a related note: what logic did you run to determined favourable pairs correlations? i've been trying to figure that out. If you'd rather not share in a public forum, I can chat in the slack group . I have the same username, 'ekz'.
Hope this helps.
Grateful Trading
This is really helpful. Thank you!
I'm going to tweak my correlation algo a bit more before I share. Feel free to check back with me later via email.
Grateful Trading
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!