Hi Everyone,
I am working on a multi-universe algorithm, and have a few general questions
For background, I am using two universes, created in Initialize() as below
# Built-in QuantConnect Universe
self.AddUniverseSelection(QC500UniverseSelectionModel())
# User-Defined Universe in a Seperate File
self.AddUniverseSelection(SimpleUniverseSelectionModel())
My questions are as follows
- What exactly are the differences between the AddUniverse() and AddUniverseSelection() functions? My understanding is that AddUniverse() returns a reference while AddUniverseSelection() does not, and that AddUniverse() takes a filter function while AddUniverseSelection() takes an object.
- If my above understanding is correct, what is the best way to differentiate between universes created by AddUniverseSelection()?
Specifically, I can loop through my algorithm's universes with something like
for universe in self.UniverseManager.Values:
...
But I run into issues because
- There is no way to store a reference to individual universes when creating them with AddUniverseSelection(), as there is with AddUniverse().
- There is no way to pass a 'name" to individual universes when creating them with AddUniverseSelection(), as there is with AddUniverse().
- The engine-assigned “names” are not meaningful. In my example, my two universe names are “QC-UNIVERSE-COARSE-USA-E8C0F56F-59C1-4B5D-9310-2D2BB0ECF4FD”, and “QC-UNIVERSE-COARSE-USA-630CF869-A81F-4E22-A673-D825D9986EE9”, which are not particularly helpful.
In my case, I am able to differentiate between my two universes by using the UserDefinedUniverse keyword, since it happens that I created one of my universes, and Quant Connect created the other
for universe in self.UniverseManager.Values:
if universe is not UserDefinedUniverse:
qc500 = universe
But, if this were not the case, how would I go about solving this problem.
Thanks!
Rafael Trevisan
Same question here: What exactly are the differences between the AddUniverse() and AddUniverseSelection() functions?
Louis Szeto
Hi Chase and Rafael
It is not able to track the assets added by AddUniverseSelecion since it returns nothing. It is only possible to track with a regular universe. (docs)
The difference between them would be AddUniverseSelecion takes input argument of a UniverseSelectionModel (which mainly provides by QC for abstracting some popular methodology in universe selection), while AddUniverse has a lot more variety and on your control.
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.
Chase Feng
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!