The new FundamentalUniverseSelectionModel --> AlphaModel interaction appears broken. Specifically, it looks like the alpha model is not honoring Universe.Unchanged returned from the univer selection model's Select() method. Consequently, the alpha model's OnSecuritiesChanged() method is triggered unexpectedly.
Please check debug logs.
Mia Alissi
Based on the provided code, it seems like the
ShellUniverseSelectionModelclass is not correctly handling the rebalance flag. TheIsRebalanceDuemethod sets thewas_rebalancedflag toTrueevery time it is called, regardless of whether a rebalance is due or not. This could potentially cause theOnSecuritiesChangedmethod in theShellAlphaModelclass to be triggered unexpectedly.Here's a potential fix:
In
ShellUniverseSelectionModel.py, modify theIsRebalanceDuemethod to only setwas_rebalancedtoTruewhen a rebalance is actually due:This way,
was_rebalancedis only set toTruewhenself.flagisTrue, indicating that a rebalance is due. This should prevent theOnSecuritiesChangedmethod from being called unexpectedly.Remember, this is just a suggestion based on the provided code and the described issue. You might need to adjust it according to your specific needs and logic.
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.
Dhruv Bhandari
There is nothing wrong with how was_reblanced is set, it is not being set to True every time. Besides, was_rebalanced is irrelevant to the universe selection and alpha models and only used by the portfolio constrcution model.
Alexandre Catarino
Hi Dhruv Bhandari ,
When we log the changes object, we only see removals.
Universe Selection is triggered when the securities are removed from the universe when they are delisted.
Best regards,Alex
Dhruv Bhandari
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!