@AnkitDoshihttps://kite.trade/docs/connect/v1/#orders seems quite clear about this. Just do a getOrders() call and then check for status on your end. If the status is not cancelled, completed or rejected, it means the order is pending.
I am trying to code the logic of 1) Cancelling BO orders that never got triggered and 2) Cancelling Partial lot (volume) BO orders that were not triggered i.e. For the remaining volume the order is still not executed.
I see the status as OPEN and not PENDING. How do i fetch such pending BO orders to cancel
@sr11 There is no pending status. It's "OPEN" (0 filled and partially filled). You can look at the product or variety field to check for "BO"s. Second legged orders will have a parent_order_id as well.
As i see in my kite orderbook, there are 2 types of BO orders (irrespective of filled or partial). One is BO-BUY-OPEN and the other is BO-SELL-OPEN, I want to cancel the BO-BUY-OPEN which is essentially the pending BO orders. If i filter open orders with BO & OPEN then it can even cancel pending Sell orders right?
In Python?
kite.orders() gives me list of all orders. What is command to get pending orders?
There is no separate API for pending orders. You have to fetch whole orderbook and filter pending orders as mentioned by Nikhil.
I am trying to code the logic of 1) Cancelling BO orders that never got triggered and 2) Cancelling Partial lot (volume) BO orders that were not triggered i.e. For the remaining volume the order is still not executed.
I see the status as OPEN and not PENDING. How do i fetch such pending BO orders to cancel
Thanks
Srinath
As i see in my kite orderbook, there are 2 types of BO orders (irrespective of filled or partial). One is BO-BUY-OPEN and the other is BO-SELL-OPEN, I want to cancel the BO-BUY-OPEN which is essentially the pending BO orders. If i filter open orders with BO & OPEN then it can even cancel pending Sell orders right?
-SR
I was able to correctly filter out the orders i wanted to cancel. Currently getting an exception
#1kite.order_cancel("1200000001907812", variety="bo")
raise(exp(data["message"], code=r.status_code))
OrderException: MSG_FAILURE
#2kite.order_cancel("1200000001907812")
raise(exp(data["message"], code=r.status_code))
OrderException: The order couldn't be cancelled
-SR