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?
Hi @npchoubey, Kite web and mobile does the same. It places the same quantity market order with the same product. You must have missed the product type which results in system perceiving you are going to short with the new order.
Either u have already placed the limit buy order for tht option and it was pending in order history ..
Second .. zerodha was not allowing to square off the options at market yesterday and today .. They were asking me to set the limit order for tht .. So tht may be the issue ..
@hitman1980, We don't allow market orders for Stock options. You will have to place a limit order at LTP. This has been the RMS policy for a very long time.
Kite web and mobile does the same. It places the same quantity market order with the same product. You must have missed the product type which results in system perceiving you are going to short with the new order.
this is how coded to squareoff short position . anything else I need to add here?
kite.place_order(variety="regular", tradingsymbol=buy_ce,
validity="DAY",
quantity=buy_ce_q, exchange="NFO",
order_type="MARKET", transaction_type="BUY",
product="MIS"
)
OPTIONS BANK NIFTY
Either u have already placed the limit buy order for tht option and it was pending in order history ..
Second .. zerodha was not allowing to square off the options at market yesterday and today .. They were asking me to set the limit order for tht .. So tht may be the issue ..
Read all open orders.
Cancel all of them. (Target the BO,CO,OCO exceptions here).
Then,
Read all the current open positions.
Shoot reverse positions.
I call it powerkill lol. Its apt as I mostly use in BankNIFTY.
We don't allow market orders for Stock options. You will have to place a limit order at LTP. This has been the RMS policy for a very long time.