I am using framework way to create an algorithm. For example I have 3 universes, A B and C, and I used AddUniverseSelection(). When I am in AlphaModel, I would like to know the list of securities from A universe. I know I can loop like this in def Update(self, algorithm, data):
for kvp in algorithm.UniverseManager:
symbol = kvp.Key
universe = kvp.Value
But I don't know which universe is A, which is B and so on...
How to get the target universe? Or is there a way to get the target universe security list?
Thank you very much.
Shile Wen
Hi Sulfred,
To access the target Universe securities, we can iterate over its .Members field, where the Key is the Symbol and the Value is the securities. I’ve shown how to do in the attached backtest.
Best,
Shile Wen
Sulfred
Hi Shile,
Thank you for your reply. Your answer works. I can get the security list from the universe, but I still don't know which universe is my target.
For example, I have 2 universes, A and B. Both of them are Fundamental Universe which menas the security list is changing dynamically. I have multiple Alphas. One of the Alphas is looking for the security list generated by Universe A. I would like to ask that if there is a way for that Alpha to identify the target Universe.
Thank you very much.
Shile Wen
Hi Sulfred,
We can extract information from the Symbol the UniverseManager assigned to a given Universe, and make a decision based on this information. I’ve shown how to do this in the attached backtest.
Best,
Shile Wen
Sulfred
Hi Shile,
Yes, I can extract the Symbol from UniverseManager, but how to assign the customer symbol to it so that I can know that which universe is my target universe in alpha model?
Attached is the backtest. I created 2 Fundamental Universe, A_Universe and B_Universe. I print the symbol and see that QC-UNIVERSE-COARSE-USA-0D99CBEF-4DA0-40CB-A00B-C034ECB3345B 2T and QC-UNIVERSE-COARSE-USA-60157FEF-A429-47D0-B2A4-D198059B12E3 2T
How to identify the target universe ?
Shile Wen
Hi Sulfred,
It is not possible to identify Universes that derive from FundamentalUniverseSelectionModel at the moment.
Best,
Shile Wen
Sulfred
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!