I have a Bull Put Credit Spread strategy I'm working with. Under some circumstances the algorithm will get assigned on short leg early. I would like to immediately exercise my long leg in this situation. In this back test I get assigned 2000 shares of spy before expiration. The attempt to to exercise the long protection leg fails due to insufficient buying power. Typically I think a covered position would be able to exercise. If you have x shares to cover the exercise then funds should be not a problem. The algorithm eventually does exercise the option at expiration but not my desired behavior.
Laurent Crouzet
Hey Mike Kemner
I checked and you are right: the issue “Order Error: id: 8, Insufficient buying power to complete order (Value:-622000), Reason: Id: 8, Initial Margin: 300890, Free Margin: 291310” should not happen in the real word of a put spread, with one leg assigned and if you directly want to exercise the second leg.
The issue here is that the buying power is not correctly calculated, and forcing the BrokerageModel for instance by adding “self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)” in Initialize()… does not solve the problem.
I am not an expert of buying power issues through QC, but I fear that only someone from QC could help you on this, unfortunately…
Derek Melchin
Hi Mike & Laurent,
We've created a GitHub Issue to have the problem resolved. Subscribe to our progress 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.
Mike Kemner
Thank you both for looking at it. I don't think I was the first to run into the issue as I searched but no one was able to recreate it to the basic problem shown in the github.
Mike Kemner
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!