How to exit multiple Cover Order

sabyasm edited September 2016 in Python client
The developer doc says - there is no special api call for existing a position taken through the cover order.
There are no special API calls for exiting instruments from holdings and positions portfolios. The way to do it is to place an opposite BUY or SELL order depending on whether the position is a long or a short (MARKET order for an immediate exit). It is important to note that the exit order should carry the same product as of the existing position. If the exit order is of a different margin product, it may show up as a new position in the portfolio.
If I have successfully placed 3 different CO for the same symbol with 3 different stop loss value, how would I be able to exit one of them using the api call?

For example: 3 separate CO BUY for SBIN (status = 'COMPLETE')

160901000074534 -- 3 SBIN entered at 200
160901000074536 -- 3 SBIN entered at 201
160901000074660 -- 3 SBIN entered at 202

So, there exists 3 SELL orders with "TRIGGER PENDING" (160901000074535,160901000074537,160901000074661)
  1. Now would like to exit one of the position - say order_id 160901000074535 , how does the python api call looks like?
  2. Would 'order.cancel' work here?

    kite.order_cancel(order_id='XXXXX', variety='co', parent_order_id=None)

    XXXX = which order_id should I put here ? corresponds to the original order (160901000074536 ) or the SL (160901000074537)?

  3. Is there any way to exit partial position in a cover order?
  • Vivek
    After first leg is executed in cover order you can only exit the order not cancel it. You can call order cancel api with child order id(second leg trigger pending) to exit the cover order.

    Also you can't do partial cover order exit.
  • sabyasm
    Thanks @vivek it helped!
This discussion has been closed.