@sujith@rakeshr Could you please guide me on how we can prevent this error? I am sure this error occurred from my side. I am getting this error while placing an IOC order. Why is this error being thrown because of WebSocket update issues or issues from the server side?
[2024-02-06 10:47:50,160] INFO: An error occurred while placing orders: Order cannot be cancelled as it is being processed. Try later. [2024-02-06 10:47:50,160] ERROR: An error occurred while placing orders Traceback (most recent call last): File "/home/anl/ORDER_LOGIC.py", line 143, in process_order kite.cancel_order(variety=kite.VARIETY_REGULAR, order_id=buy_order_id) File "/home/anl/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 389, in cancel_order return self._delete("order.cancel", File "/home/anl/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 873, in _delete return self._request(route, "DELETE", url_args=url_args, params=params, is_json=is_json) File "/home/anl/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 937, in _request raise exp(data["message"], code=r.status_code) kiteconnect.exceptions.InputException: Order cannot be cancelled as it is being processed. Try later.
If the order is showing status of "Trigger pending" or "Open", that means the order you placed is not IOC.
In my experience, whenever I get this error "Order cannot be cancelled as it is being processed. Try later.". 99% times it is processing in the backend (like either getting filled 100% or getting cancelled). If you fetch the status of the order after this error, it will mostly show either completed or cancelled. Just my experience.
IOC will cancel automatically if it is not matched, but I want to cancel at a specific time. My strategy is to cancel if it reaches a specific time. I am getting the same error if I place a limit order.
More details here: What does Day, Immediate and Minutes Validity mean?
If the order is showing status of "Trigger pending" or "Open", that means the order you placed is not IOC.
In my experience, whenever I get this error "Order cannot be cancelled as it is being processed. Try later.". 99% times it is processing in the backend (like either getting filled 100% or getting cancelled). If you fetch the status of the order after this error, it will mostly show either completed or cancelled. Just my experience.