Hi,
In my Universe Selection Model, I used EMA as a criteria to select stocks. In my Alpha Model, I wanted to use the same EMA on the stocks I selected to set insight weight.
I was wondering if there is a way to pass indicators from Universe Selection Model to Alpha Model. Or there is a better way to tackle this problem in general?
Moreover, I noticed there is a EmaCrossUniverseSelectionModel and also a EmaCrossAlphaModel as a demo. Aren't they somewhat contradicting the idea of algorithm framework, which is to delegate different work to different module?
Thanks!
Fishstoryyy
Can someone please help? Thanks.
Varad Kabade
Hi Fishstoryyy,
I was wondering if there is a way to pass indicators from Universe Selection Model to Alpha Model. Or there is a better way to tackle this problem in general?
We generally don't advise sharing information across framework modules as it violates the separation of concerns principle.
Aren't they somewhat contradicting the idea of algorithm framework, which is to delegate different work to different module?
Not exactly, because EmaCrossUniverseSelectionModel is used to select the Universe of our model, and EmaCrossAlphaModel is used to generate insight using EMA indicator both can be different (different periods, moving average, and Resolution).
Best,
Varad Kabade
Fishstoryyy
Hi Varad,
Thanks for getting back to me. Really appreciate your answer.
“We generally don't advise sharing information across framework modules as it violates the separation of concerns principle.” - if that's the case, do you advise I warmup the same indicators both in universe selection and alpha model even though they are meant to be used in both modules? Or is there a better way to accomplish this. Thank you.
Louis Szeto
How about use a list/dict to save it and put into the alpha model as variable?
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.
Shile Wen
Hi Fishstoryyy,
Your interpretation of Varade's comment is correct, so I'd suggest implementing it in this manner.
However, while the following suggestion isn't ideal, it can come in handy if performance is an issue: you can declare an empty dictionary in Initialize of the algorithm then pass that same dictionary to both the Alpha model and Universe selection.
I've shown an example in the attached backtest.Best,
Shile Wen
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!