Apolgies if my search of the forums was poorly conducted, but I'm trying to understand a bit about consolidators. I want to experiment with 5 min and 15 min bars. I'm using the QCAlgorithmFramework approach, and I refresh my universe daily with a new set of symbols via SetUniverseSelection().
The example here
https://www.quantconnect.com/docs/algorithm-reference/consolidating-data#Consolidating-Data-Consolidators--Indicatorsshows the consolidator getting created in the Initiatlize() method of the QCAlgorithm.
How do I register a consolidator to refresh every day with a new set of symbols each time my universe refreshes? Should I put the registration for the consolidator down in my universe class? That seems like a poor design.
What's the proper, elegant, way of doing this? Thanks!
Jack Simonson
Hi Ted,
When you use Universe Selection, the most effective way of registering Consolidators for new securities is to declare a class specifically to hold indicator information for securities. Then, as new securities enter the Universe the algorithm can create instances of this new class and register Consolidators (this is best done in the OnSecuritiesChanged() method). You can see a brief example in the backtest I've attached and hopefully, this will help with designing your algorithm.
Lars Snoeijink
Hey Jack this is really helpful, thanks!!!
I do however still wonder where the updating comes into play here. Now you have created a SymbolData object for every symbol in your universe, which you can pass on to your alpha models Update function. This function generates insights based on this SymbolData, however, can it also update this particular data? For an update to occur we would have to call the SymbolData function in the OnData function no? That would mean we could circumvent the AlphaModel and could directly generate insights via the OnData, which makes me wonder if the alpha model has any useful contributions. Or is it the algorithm framework that also passes the time to the AlphaModel simultaneously with the OnData function?
Thanks in advance,
Cheers,
Lars
Derek Melchin
Hi Lars,
Yes, we can update the SymbolData objects inside the definition of the Update method. However, the consolidators are automatically updated with the latest data and fire the consolidation handlers when the consolidated bars are ready.
SymbolData is a class, not a function. To emit insights, we can iterate through the SymbolData objects in the Update method.
The algorithm manager passes the current slice object to the OnData and Update methods. For reference, see Event Flow.
We can call EmitInsights to emit insights from the OnData method, but the philosophy of the Framework design is to isolate different parts of the algorithm logic into different objects. For more information, see Framework Advantages.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
TedVZ
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!