Quantconnect's Idea Stream posted an interesting video on YouTube about Traunch Rebalancing Risk Parity a few months ago.
https://www.youtube.com/watch?v=q1VjM1nHPfE&list=PLD7-B3LE6mz7_H1xzHiy1J8whTgnQK7nJ&index=7
The Traunch Rebalancing Risk Parity strategy rebalances a 1/12 of the portfolio monthly to maintain a 60/40 between stocks and bonds regardless of how the market is moving.
This algorithm uses Parabolic Stop And Reverse to adjust the ratio of stock and bonds depending on how the market is moving on a month by month basis. The alpha model uses the Parabolic SAR to either emmit bull or bear insights:
if self.algorithm.Securities[str(self.risk)].Price > self.psars[str(self.risk)].Current.Value:
return self.bull_insights
elif self.algorithm.Securities[str(self.risk)].Price < self.psars[str(self.risk)].Current.Value:
return self.bear_insights
I would appreciate any ideas or thoughts on this algorithm.
Derek Melchin
Hi Nibraas,
Great work on this strategy!
There are a few changes we could make though.(1) When setting a custom fee model for securities in a universe, we can use
class MyAlgo(QCAlgorithm): def Initialize(self): ... self.SetSecurityInitializer(self.CustomSecurityInitializer) def CustomSecurityInitializer(self, security): security.SetFeeModel(ConstantFeeModel(0))
(2) In the alpha model's Update method, we can access the current price of a security with
slice[self.risk].Close
instead of
self.algorithm.Securities[str(self.risk)].Price
With this change, we no longer need to save a reference to `algorithm` and follow the separation of concerns design principle.
(3) Instead of creating a dictionary of PSAR indicators, we only need to setup a PSAR indicator for QQQ.
See the attached backtest which implements the fixes above. Going forward with development, the PSAR indicator needs to be manually warmed up. During the first rebalance, the indicator is not ready. Refer to our documentation for assistance.
Best,
Derek Melchin
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.
Nibraas Khan
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!