Backtest on SPX fails with the orders below -
Invalid Simulated option assignment before expiration
Invalid BrokerageModel declared unable to submit order: [665] Warning - Code: NotSupported - The InteractiveBrokersBrokerageModel does not support OptionExercise exercises for index and cash-settled options.
Reports the below error in the logs.
Runtime Error: Duplicate option exercise order request for symbol SPXW 221221P04030000. Please contact support in BacktestingBrokerage.cs:line 482
Expected: SPX is index and cash-settled option and it should not have option assignment.
Is there anyway to turnoff the option assignment for the backtest?
Ashutosh
Hi @ram-panguluri
I was looking around for a way to turnoff the option assignment and found some ways that can be helpful or give a good direction to achieve this.
The idea is to create a customBrokerage class which can override the “CanSubmitOrder” method of the DefaultBrokerageModel to turnoff the option assignments.
I'm not coded in C# much but I guess you will get some idea and direction with this:
You can then set the brokerage account as custom brokerage in the Initialize method:
Let me know if this worked out!
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.
Ram Panguluri
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!