Basket orders for options

If I place a basket order for a iron condor - by keeping the two long strikes first followed by the two short strikes , ( all limit orders )
What if the short strike orders get executed first before the long strikes - in that case - even though I executed it on the basket will my margin increase ?

Yes. But soon after the long orders are also executed, the final margin as mentioned in the basket will be reflected in the funds. In case you don’t have enough funds to fulfil margin required for short orders, they will be rejected and the long orders are filled first. You will have to repeat the short orders again to complete the strategy.
If you use sensibull to select strikes and place orders, it will give you a hint to place buy orders first and then sell orders.

If the buy order is not executed first, you won’t get margin benefit and will need full SPAN + Exposure margin for short position. If you don’t have sufficient margins, the order will be rejected, if you have, it will be executed.

Also, once the buy leg is executed, you will get the margin benefit and margin requirement will reduce.


Does the same logic apply when I’m squaring off the position ?
If I sell the long strikes before the short strikes will my margin requirement increase ?

Yes. If you squared-off the long leg first, you will no longer be getting margin benefit as increase the margin requirement for short positions.

Also, if you don’t have sufficient margins, this will result in your margins going negative and will lead to peak margin penalty. You can learn more on this here: What are margins and how can margin shortfall occur?


Any suggestions on how to efficiently execute an iron condor through an algo ?

This margin rule is creating problems.