Margin Shortfall for expired option

I have a query here.
I was trading Bank nifty options on expiry day.
I had iron condor. At 3:25 PM, I selected all the positions and pressed the exit all option on kite.
To my surprise my buy positions got squared off but the sell positions got rejected saying that the margin is not sufficient. When i looked at the available margin it had gone to negative since the buy positions were squared off thereby the margin advantage was gone.
All this happened at around 3:25 PM

the sold options have expired worthless but the margin is showing negative.
Would there be penalty for expired options ?

You need to ensure you are maintaining sufficient margins in your account all the time as exchange takes snapshot of your position and margins at random times during trading hours. Exchange takes 4 snapshots during the day, and during this time if there is shortfall in margins, there will be margin shortfall penalty applicable. You can learn more about this here.

Would suggest going forward you first square-off short positions first and then square-off long option position, this way you will avoid margin shortfall.

Thanks for the response.

  1. That means it is possible that there might not be any penalty at all since this happened at 3:25 PM when the trading hours are almost over. But if the snapshot was taken between 3:25 and 3:30 there would be a penalty ?
  2. Also, can’t zerodha tech team make sure if we select the exit all option, the sell options are squared off first and buy ones later. what’s stopping you guys in this ?
  3. How/ When will I know if the penalty was levied or not ?

Ah, sorry. Missed that bit. There will be shortfall penalty, please check out this post: Margin Penalty applicable if all my short options expire tonight - #4 by MohammedFaisal

When you’re selecting exit all, you will be placing market order. Here execution depends on market factors, for some contracts, liquidity will be good, while there won’t be much for others, so the execution can vary.

Hence, when you’re squaring-off your position, best to first exit short leg and the the long.

@ShubhS9 Has happened with me many times. I now realise we should not exit all but manually exit shorts first.

My question is will there be a penalty if the difference in timing between exiting short and long is less than 2 seconds or near simultaneous?

This is hard to tell as exchange takes snapshot at random times. So better to be cautious.