Execution model does not receive all targets in one go. Instead, targets seems to be split into a few subsets that the execution model receive in a few separate calls. This is not a desired behavior I want, how can I override it?
QUANTCONNECT COMMUNITY
Execution model does not receive all targets in one go. Instead, targets seems to be split into a few subsets that the execution model receive in a few separate calls. This is not a desired behavior I want, how can I override it?
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.
Mia Alissi
In QuantConnect, the Execution model receives an array of risk-adjusted
PortfolioTarget
objects from the Risk Management model and places trades in the market to satisfy the targets. It only receives updates to the portfolio target share counts and doesn't necessarily receive all of the targets at once.If you want to change this behavior, you can create a custom Execution model by extending the
ExecutionModel
class. You need to implement theExecute
method, which receives an array ofPortfolioTarget
objects at every time step and is responsible for reaching the target portfolio as efficiently as possible.Here is a basic example of how to create a custom Execution model in Python:
In the
Execute
method, you can implement your own logic to handle thePortfolioTarget
objects as you wish.Remember to set your custom Execution model in the
Initialize
method:For more information, you can refer to the Key Concepts and Supported Models sections in the QuantConnect documentation.
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.
Chuanjiang Luo
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!