Hi,
I am utilizing the algo framework with a fine universe selection model, custom alpha model, and equal weight portfolio construction model.
I noticed that my algorithm will liquidate my position of a security once that security is removed from then universe even though the insight is still valid, The result is, my position is always forced to be closed out in the next morning (9:31am, my resolution is minute) no matter how long my insight is valid for…
If there a way to prevent that from happening or am I missing something?
Louis Szeto
You can save your selected equities in universe to the QC algorithm by using a list like in python while this list is created in initialize method:
Then your universe have all assets you needed. Your further analysis can just call self.selected_thistime list of symbols without using previous episode selection.
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.
Fishstoryyy
Hi Louis,
Thank you for the reply. I will try that out.
I guess my question is more from the algorithm framework design perspective. I somehow felt that the validity/expiry of insight should be prioritized and not impacted by universe selection.
Derek Melchin
Hi Fishstoryyy,
To stop the portfolio construction model from liquidating securities that are removed from the universe but have an active insight, we need to add
and override the rebalancing function of the PCM.
See the attached backtest for reference.
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.
Fishstoryyy
Thanks Derek that helps!
Fishstoryyy
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!