But it booked a new trade and asked for further margin instead of closing the position we already had. Can you please let us know what we need to do to close off the position?
You need to check the quantity of the position before squaring off the position. The above method seems fine, maybe the first order might have gotten rejected or you might have placed a sell order twice. You can check your orderbook on the kite for more details.
It was in the order book already (not rejected) and it still asked for 'further margin'.. I was able to manually square off from my position, which proved that it was in order book anyway ... Is there any parameter I was missing or should I use 'order number' while doing a sell trade?
The above method seems fine, maybe the first order might have gotten rejected or you might have placed a sell order twice. You can check your orderbook on the kite for more details.