Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Improperly being Margin Called when selling option spreads

Open mattmcwaters opened this issue 3 years ago • 3 comments

When selling a bear put spread (Sell put with strike higher than a put you buy, same quantity and expiration), we hedge ourselves by buying a put against the one we are selling. Our risk is limited and we expect to have no margin calls if our margin remaining is above the maximum loss dictated by the difference between the credit and debit of the strategy.

However, we still see margin calls when using strategies like this in QC. See backtest below: https://www.quantconnect.com/terminal/processCache?request=embedded_backtest_84f70b9a9b7dfcb74ee1575dc5fe1287.html

mattmcwaters avatar May 17 '22 18:05 mattmcwaters

Hey @mattmcwaters! It seems the margin calls are for the underlying SPY equity, the options are getting executed. Maybe related to this other issue https://github.com/QuantConnect/Lean/issues/5857 . Mind expanding on what behavior would you expect to be seeing?

Martin-Molinero avatar May 20 '22 23:05 Martin-Molinero

hey @Martin-Molinero, just looked through the orders. You're right! It gets automatically assigned. I think adding the ability to turn off automatic assignment as suggested by #5857 would fix this, however I think it's a band-aid. The real issue is that we are even considering automatically assigning an option strategy like a credit or debit spread, which would never happen with IBKR or any respected brokerage due to the limited finite risk.

Should I edit the issue to reflect the true root cause or make a new one?

mattmcwaters avatar May 23 '22 16:05 mattmcwaters

he real issue is that we are even considering automatically assigning an option strategy like a credit or debit spread, which would never happen with IBKR or any respected brokerage due to the limited finite risk.

Right, I see the point now 👍

Should I edit the issue to reflect the true root cause or make a new one?

No it's okay as is 👌 the comments are enough I think

Martin-Molinero avatar May 23 '22 21:05 Martin-Molinero

Base on IB documentation we believe option strategies are not taken into account when automatic assignment takes place. Take a look at the following reference https://ibkr.info/node/222, specifically the Margin Deficit from the option assignment section

If the assignment takes place prior to expiration and the stock position results in a margin deficit, then consistent with our margin policy accounts are subject to automated liquidation in order to bring the account into margin compliance.

Additionally, for accounts that are assigned on the short leg of an option spread, IBKR will NOT act to exercise a long option held in the account. IBKR cannot presume the intentions of the long option holder

Will close this issue now but we are working on allowing option assignment to be disabled if desired https://github.com/QuantConnect/Lean/issues/7142

Martin-Molinero avatar Mar 30 '23 22:03 Martin-Molinero