As you have placed Sell order first in the basket, this will require full SPAN + Exposure margin, as you didn’t have sufficient funds your order was rejected.
Would request you to place Buy order in Basket first followed by Sell order, this way when your buy order is executed you will get margin benefit beforehand and won’t require full SPAN + Exposure margin to execute sell order.
To get better understanding of Basket Order, you can refer to this post, which explains everything in detail.