I'm looking at the examples for the RiskManagement module creation. One of the ideas is to create a "flash crash" risk management model, I was wondering if there's any code that would demonstrate this. Reason I ask is because I have a similar algorithm that I would like to turn into a Risk Management module to have it be reusable in other algorithms, but I'm not sure how to subscribe and use indicators within a Risk Management module since its not receiving a "data" object in the ManageRisk function.
What would be the best way to go about this?
Jared Broad
The algorithm object holds everything you need to access all data. The latest data points are in the algorithm.CurentSlice property
This folder holds examples of risk management models:
https://github.com/QuantConnect/Lean/tree/master/Algorithm.Framework/RiskThe 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.
John Radosta
Hey Jared, thanks for the response.
Just so I'm clear, if you wanted to emit Insights on say the VTI (total market) from the algorithm.CurrentSlice property, you'd have to add the VTI security in the algorithm first (whether via Coarse/Fine Selection, Universe Selection Model, or manually adding) before the Alpha can access the symbol data. Correct?
Jared Broad
You can construct whatever you need in the risk model constructor. Just like other data sources, each model should add the data sources it needs to maintain its independence.
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.
John Radosta
But they all have a data dependency from the algorithm itself still then, correct? So while a RiskManagement Model A may maintain its indepdence from Risk Management Model B, they still both rely on the algorithm instantiating them and passing the data subscriptions via the algoirthm.CurrentSlice object, correct?
In other words, there is one data feed passed by the algorithm to all Alphas, Risk Management Models, etc. They cannot instantiate their own independent data feeds.
Just trying to better understand.
Jared Broad
All good. I'd forget entirely about A/B and just make risk models who serve their specific purpose well. The QCAlgorithm layer is there to serve its consumers with data and features.
> There is one data feed passed by the algorithm to all Alphas, Risk Management Models, etc
Correct. The management of the subscriptions and whether a new one is needed is handled at the QCAlgorithm layer.
> They cannot instantiate their own independent data feeds.
Incorrect. They can instantiate whatever they need. This is covered in the Sentiment Analysis Boot Camp. Risk models are no different from Alpha models. All models can just add the data they need, at any time. The consumer layer is free to do whatever it needs to do.
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.
John Radosta
Ah I see, that makes sense. They can instantiate whatever they need but the algorithm still provides the data feed. Cool.
John Radosta
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!