I am receiving these events:
"Simulated option assignment before expiration - Automatic Assignment"
in my backtests with options in a seemingly random way, which is very bad for the consistency of the results.
How can I disable them?
Thanks
QUANTCONNECT COMMUNITY
I am receiving these events:
"Simulated option assignment before expiration - Automatic Assignment"
in my backtests with options in a seemingly random way, which is very bad for the consistency of the results.
How can I disable them?
Thanks
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.
Derek Melchin
Hi Jose,
The BasicOptionAssignmentSimulation class simulates the activity of market makers. To ensure realistic backtest results, it can't be disabled. Refer to the source code here.
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.
Tb
I understand the need to make developers consider such eventualities (though the amount of automatic assignments I'm seeing seems quite unrealistic). Could you point me to an example of detecting that assignment on the short leg of a spread has happened and immediately closing the appropriate number of long contracts? I.e. if sold 10 put spreads, 3 short contracts got assigned getting replaced with 300 new underlying shares, and closing out those new shares and the three corresponding long contracts,
Louis Szeto
Hi Tb
LEAN would automatically assign/exercise in-the-money option, while out-of-money option (including other legs in option trades) and the assigned underlying asset will not be offset. We recommend liquidating them after one leg gets assigned in OnOrderEvent method. For example:
Best
Louis Szeto
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.
Tb
Thanks for the response. Is the trick then how you have specified the securities to liquidate? Is the no argument overload Liquidate() not supposed to work in OnOrderEvent? It has been a couple days so I'm fuzzy on the details, but I seem to remember having problems calling Liquidate() from either OnAssignmentOrderEvent or OnOrderEvent so I ended up using them to set a flag and if that flag was set, Liquidate() in OnData.
Louis Szeto
Hi Tb
Liquidate() shall work fine within OnOrderEvent, as it is only an instruction for order.
Best
Louis
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.
Jose
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!