SquareOff existing order at MARKET

npchoubey
Hello,

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?



  • sujith
    sujith edited September 25
    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.
  • npchoubey
    thanks for response
    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"
    )
  • sujith
    Is this option instrument or future instrument?
  • sujith
    Are you trying to close short position?
  • npchoubey
    npchoubey edited September 25
    yes, trying to close short position

    OPTIONS BANK NIFTY
  • sujith
    Can you try today and post the order id today? This looks fine. We need more details to look into this.
  • npchoubey
    is it ok, if i give earlier order id ?
  • sujith
    Order history is wiped off everyday. So, we require a current day order id.
  • hitman1980
    There may be 2 reasons ..

    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 ..
Sign In or Register to comment.