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
ShellUniverseSelectionModel
class is not correctly handling the rebalance flag. TheIsRebalanceDue
method sets thewas_rebalanced
flag toTrue
every time it is called, regardless of whether a rebalance is due or not. This could potentially cause theOnSecuritiesChanged
method in theShellAlphaModel
class to be triggered unexpectedly.Here's a potential fix:
In
ShellUniverseSelectionModel.py
, modify theIsRebalanceDue
method to only setwas_rebalanced
toTrue
when a rebalance is actually due:This way,
was_rebalanced
is only set toTrue
whenself.flag
isTrue
, indicating that a rebalance is due. This should prevent theOnSecuritiesChanged
method 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!