Order cannot be cancelled as it is being processed. Try later.

ANL
@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.
  • sujith
    An IOC order gets cancelled if it does gets filled. Are you sending cancel request for an IOC order?
  • ANL
    I want to cancel a pending IOC order as it is not COMPLETE. The status of the order is still in TRIGGER PENDING or OPEN.
  • KamalChhirang
    KamalChhirang edited February 6
    IOC gets cancelled automatically. You don't need to cancel it on your end. That's the whole concept of IOC.

    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.
  • ANL
    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.
  • KamalChhirang
    KamalChhirang edited February 6
    Don't place an IOC order, it will cancel automatically. Place a order with "DAY" validity. Then cancel at whatever time you want.
  • ANL
    ANL edited February 6
    @sujith Can you please shed some light on how this error occurs?
Sign In or Register to comment.