cancelling bo order

Guhan
@sujith,
today when I canceled a partially executed BO order my entire BO position of particular stock got exited. What are the details you guys need to correct my mistake?
  • sujith
    Did you cancel the first leg or exit second leg order?
  • Guhan
    i have sent the workings as private message
  • Guhan
    @sujith, what are the params that needs to be passed to cancel partially filled BO and MIS order?
  • sujith
    You need to send order id, parent order id, and variety.
  • Guhan
    @sujith, no I am asking for first leg order pramas correct me if I am wrong,
    BO - orderid, variety = 'bo',
    mis order - orderid, variety = 'regular'
  • sujith
    yes, you are right.
  • Guhan
    Guhan edited April 2018
    @sujith, in continuation of the issue that I mentioned in the beginning I am facing the same problem still. Below are the steps I followed to cancel the order

    1) fetch order_book
    2) filter the order_book by order_id that I got while placing the order
    3) then check whether the status of order is 'OPEN'
    4) if yes then
    kite.cancel_order(order_id=order_id,variety='bo')

    what happened was partially filled order's position got cancelled
  • sujith
    In that case, you need to exit second leg orders also with the cancellation request.
    You need to loop through orderbook to find all the pending orders with parent_order_id same as the first leg order id and then exit them.
    You can exit one of the second leg order, no need to do it for both. But make sure to handle scenario wherein there can be multiple pairs of second leg orders.
  • Guhan
    Guhan edited April 2018
    @sujith, I think I am not clear. what I did today was I placed BUY bracket order for 6 shares of JUSTDIAL, but only 2 shares were bought, then I cancelled the partially filled first leg order using kite.cancel_order(order_id=order_id,variety='bo') method,
    along with the first leg order, second leg orders also got cancelled i.e my buy position(qty 2) of JUSTDIAL got exited automatically - got sold at market price.
  • Guhan
    Guhan edited April 2018
    @sujith, hope U understood the issue, I canceled the partially filled 2/6 order using kite.cancel_order(order_id=order_id,variety='bo'), along with the original order my position also got closed.
  • sujith
    We are working on fixing the issue.
  • Guhan
    @sujith, is there any update on the above issue?
  • sujith
    It is fixed now. You can now cancel only first leg partially filled order.
  • Guhan
    @sujith, thank you, is it possible to subscribe to futures mid-month, far-month expiry's historical data?
  • sujith
    sujith edited April 2018
    Please elaborate and post it in a new thread. It will help others who are looking for the same.
This discussion has been closed.