seeing "Couldn't find that `order_id`." for exit_order () Python

Hi ,
I am seeing kiteconnect.exceptions.GeneralException: Couldn't find that `order_id` for exit_order() call

File "/home/king/python/zerodha/", line 263, in end_order
ordered_id = kite.exit_order(kite.VARIETY_REGULAR,orderid)
File "/home/king/.local/lib/python3.7/site-packages/kiteconnect/", line 383, in exit_order
return self.cancel_order(variety, order_id, parent_order_id=parent_order_id)
File "/home/king/.local/lib/python3.7/site-packages/kiteconnect/", line 379, in cancel_order
params={"parent_order_id": parent_order_id})["order_id"]
File "/home/king/.local/lib/python3.7/site-packages/kiteconnect/", line 834, in _delete
return self._request(route, "DELETE", url_args=url_args, params=params, is_json=is_json)
File "/home/king/.local/lib/python3.7/site-packages/kiteconnect/", line 894, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.GeneralException: Couldn't find that `order_id`.

Could you please help on how to fix this
  • sujith
    One has to place a market order of opposite transaction type to exit a position(MIS/NRML/CNC).
    The method exit order is for bracket and cover order only.
  • rakeshr
    Couldn't find that `order_id` for exit_order() call
    Are you trying to extract order_id field from the exit order response?
    exit_order method only have exited order_id number eg: 12345678, not the order_id field. You can check the code here.
Sign In or Register to comment.