Back

Option combo margin calculation

I'm backtesting a strategy using a bull put spread and I'm finding that the margin calculations are incorrect and my orders are rejected as invalid.

The margin requirement is usually calculated as the max loss, which should be (high strike - low strike) * 100. Details here:

https://tastyworks.desk.com/customer/en/portal/articles/2658392-short-credit-vertical-spread

However it looks like LEAN doesn't support calculating the margin for a spread and treats it as if I'm trying to sell a naked put then buy a completely unrelated option. See attached backtest.

Am I doing something incorrectly here or does LEAN not support option spread margin calculation?

If the latter, is there somewhere to report it? And is it possible to turn off the margin checks to work around it? I know I can just set an obscenely high starting cash but that breaks profit calculations.

Update Backtest








Hi, I am having the same issue - wondering if you found a solution?
The only "solution" I have found for backtesting is to set my starting cash to far, far above what I'm actually looking to trade with to avoid the margin rejection. Obviously this is not a sufficient solution for live trading.

Also, related, any chance you or anyone else knows how to set a limit order specifically on the spread of the 2 premiums? I.e. execute both orders simultaneously only if the (bid price of sold - ask price of bought) > X?

Thank you.

0

At the moment, Lean/QuantConnect only have margin models that treat orders separately. So, yes, LEAN not support option spread margin calculation.
I have create an issue in GitHub: Combo buying power model #2709

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed