Basket Orders not excuted as our purpose

I want to sell nifty one Lot as well. I want to buy a long OTM to reduce the cost of selling. It is ok upto creating basket order after the time of executing the sell order rejected. Reason is no sufficient money. Why is the basket order not executed properly or any thing I have to do?

We wish to notify you that when initiating an order through a Bracket order, the complete margin is necessary for the intended transaction. For instance, if you intend to place an order to Sell 19600 PE, the required margin is approximately Rs. 1,08,421.50. Similarly, for a Buy 19000 PE, the corresponding premium is needed. Once the Hedge position is established, you will start receiving the benefits of margin.

Therefore, we kindly urge you to ensure an adequate margin is maintained while placing your order.

You can use a python program to place the order via an API. Then it will first perform the buy leg and then sell will happen.

Where I have to go for PYTHON Pgm …