Exiting BO order

gkannan1965
When I place a buy BO order and the order is executed, can I exit the order by calling order_cancel() passing the parent_order_id and variety as 'bo'. When I mean exit, I want to square off the target order at that moment.
  • Vivek
    @gkannan1965 Yeah, once the order is executed you can square off by order_cancel call with parent_order_id.
  • gkannan1965
    when I call kite.orders("order_id"), the parent_order_id is not returned. How to get the parent_order_id?
  • Vivek
    @gkannan1965 You will get the parent order_id from orders() call but ideally it should also be on individual order call, will be fixed in next version.
  • gkannan1965
    Thanks Vivek. Please fix this ASAP. I will manage with the orders() call for now.
  • gkannan1965
    I am unable to cancel BO order. The error msg is as below:
    print (kite.order_cancel('160607000057123', variety='bo', parent_order_id='1
    60607000057122'))
    File "D:\Kan\API_Test\kiteconnect\__init__.py", line 309, in order_cancel
    "parent_order_id": parent_order_id
    File "D:\Kan\API_Test\kiteconnect\__init__.py", line 447, in _delete
    return self._request(route, "DELETE", params)
    File "D:\Kan\API_Test\kiteconnect\__init__.py", line 521, in _request
    raise(exp(data["message"], code=r.status_code))
    kiteconnect.exceptions.OrderException: Please select a valid BO Order to Exit
  • Vivek
    @gkannan1965 Please check if the parent and child order id is valid and also the order is not exited with stoploss or target by the time you tried exiting.
  • gkannan1965
    Thanks, I will check and revert back. I can also check using the status and cancel orders that are 'PENDING'. Will this work?
  • Vivek
    @gkannan1965 If order is pending you can cancel it normally with just order id.
Sign In or Register to comment.