Im trying out a simple option strategy and I'm getting OTM Put options exercised, according to the AI QuantConnect does not support a Python implementation of custom option exercise models.. So I dont know what to do.
Any help is appreciated
QUANTCONNECT COMMUNITY
Im trying out a simple option strategy and I'm getting OTM Put options exercised, according to the AI QuantConnect does not support a Python implementation of custom option exercise models.. So I dont know what to do.
Any help is appreciated
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
From the provided code, it seems like 'Renata' is trying to implement a strategy that sells put options on SPY. However, she is facing an issue where out-of-the-money (OTM) put options are getting exercised.
In QuantConnect, the exercise of options is determined by the OptionExerciseModel of the security. By default, QuantConnect uses the
AmericanExerciseModel
, which means that the option will be exercised if it is in-the-money (ITM) at the time of expiry. However, it's important to note that QuantConnect does not currently support a Python implementation of custom option exercise models.One potential workaround for this issue is to manually manage the option contracts. 'Renata' could add a check in the
OnData
method to see if the option is about to expire and is still OTM. If it is, she could then liquidate the position before it gets automatically exercised. This could look something like this:This code checks if the option is about to expire in the next day and if it is still OTM (the bid price is higher than the strike price). If both conditions are met, it liquidates the position, effectively preventing the option from being exercised.
Please note that this is a simplified example and might not cover all possible scenarios. It's also important to thoroughly backtest this strategy to ensure it behaves as expected.
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.
Renata
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!