From GUI we have option to select an MIS order and simple exit. it will execute MARKET order.
There seems to be no way to do that using api.
I noted that exit_order is only for BO/CO orders and there is no other api which reference existing order_id to execute command.
when i tried to execute a counter MARKET BUY order for exactly same quantity/scrip for already opened position, order got rejected a margin insufficient. This kind of check is not done when we exit from GUI.
Why api checks for margin when its counter order to close position? How can we emualte GUI exit option using api?