First, I bought some Nifty put and then when I tried to square off the position through the API by selling the same put, the platform treated this order as fresh position instead of exiting the previous position. Finally, the order got rejected due to huge margin requirements. When I tried to exit the position from web app I got the same problem. Lastly the I had to use the android app to exit this position.
So there are basically two questions
- How to square off positions from the API?
- Why web app failed to exit the position?