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:


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.