Exiting cover orders

Krish99
I Have developed an algorithm which generates signals per minute. Suppose for a buy signal I place a market cover order and in the next minute I wish to exit the second leg of the cover order. I am using the following syntax to exit the second leg

kite.exit_order(order id= oid, parent order id = poid, variety='co')

The above syntax throws the following error

Cannot cancel order as it is being processed Try later.

During the kite.exit_order() call the status of the order is "TRIGGER PENDING"
  • sujith
    Are you sure you are passing the second leg order id and it was not executed?
  • Krish99
    Hi Sujith,

    I have Confirmed that the order id which is passed is in an appropriate manner.

    Once I place my order and try to cancel it through the same program after some time delay it throws the said error

    I am able to exit the order using same syntax but through a different script and not for the one i wanted to.
  • rakeshr
    @Krish99
    Once I place my order and try to cancel it through the same program after some time delay it throws the said error
    If you handle above exception and retry with sufficient delay, it should work as desired.
    Can you paste here the required CO order placement and cancellation code? We will take look at it.
  • Krish99
    Krish99 edited June 28
    Between kite.place_order() and time.delay(45) there is logic that decides the value of the variable 'signal' . According to its value the decision to exit the order is taken.




  • sujith
    If an order is not pending then one can't exit it because it is possible that it has already squared off.
Sign In or Register to comment.