I want universe selection only when certain conditions are met. Is it possible.
For e.g change universe if majority of security are making a loss. etc
QUANTCONNECT COMMUNITY
I want universe selection only when certain conditions are met. Is it possible.
For e.g change universe if majority of security are making a loss. etc
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.
Fred Painchaud
Hi Vikash,
Sure, and the solution is pretty simple.
Code your algo exactly as if you are going to use Universe Selection all the time. But in your filter functions (coarse and/or fine), add your logic to determine if you want to use selection or not:
a) if you want to: do as usual
b) if you want to “shutdown” selection: just return an empty list (basically saying that all symbols should be removed) - of course, then, if you want to trade something, you will need some logic elsewhere to Add*() those assets OR you could also simply include the logic about what to trade when “selection should not occur” and return those symbols (so then, your selection just shifts gears basically).
Fred
Louis Szeto
Hi Vikash and Fred
Thank you for your answer Fred! Just an extra point: if you want to keep the ”previous universe” if condition is not met, you may return Universe.Unchanged in the coarse/fine filter function.
Best
Louis
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.
Fred Painchaud
Yes indeed Louis. Thanks for this third, say c), option.
Fred
Vikash ranjan
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!