Hi,
What is the best practice if there is an object that needs to be shared among the algo framework components?
For example, if there is a data-frame that influences both Alpha Model and Portfolio Constructor decisions, and this data-frame is recomputed each day, what is the best place to keep it?
My initial guess was to have it as a property on the Algorithm class itself, update it in OnData method and since we can access algorithm from both Alpha Model and Portfolio Constructor, I would have thought that we can access custom properties of the algorithm class as well. However, it does not seem to be the case.
Aram Darakchian
It is possible to access custom props of the algo class from any other frameworks components by simply passing algo instance to the constructor of those components. So problem solved.
The only question is that this method prevents the components from being "plugable", i.e. the alpha components that needs access to a specific custom prop of the algo class cannot be easily plugged into another algo. Not sure what would be considered the best practice here and how we can keep the components plugable and yet share some info among them.
Derek Melchin
Hi Aram,
The framework design assumes the separation of concerns principle is held. When an algorithm requires passing information between the framework components, we recommend opting for the Classic design.
Best,
Derek Melchin
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.
Aram Darakchian
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!