How can I get the last update on the order. I'm trying to place a SL/Target order after checking the status of previous buy order. When I use below code to check the status after 20sec delay. time.sleep(20) print(oid) order_history = kite.order_history(oid) print(order_history) order_status = pd.DataFrame(order_history) order_status = order_status['status'].iloc[0] print("Order Status:", order_status)
getting below list of all the status stages start from 'order received' till 'completed. and order_status is picking initial status only.
You seem to be fetching the order it history, it contains all the states the order has gone through in the system. For latest order status, you need to check the last item in the list. You may go through documentation to know more.
@sujith I have not tried polling for order updates; WS is out of order, so polling is also out of order? eg: If we use this approach, history[-1]['status'], will I get the latest order status in an exact order?
@sujith I have not tried polling for order updates; WS is out of order, so polling is also out of order?
I didn't get you. Can you elaborate?
eg: If we use this approach, history[-1]['status'], will I get the latest order status in an exact order?
Yes, the last item in the order history gives you the latest status of the order. You may also fetch orderbook and find by order_id and check the status.
Out of order/async status updates in WS on_order_updates, so I wanted to know that the polling order updates are out of order like on_order_updates.
orderstatus = order_history[-1]['status'] If fetching the order book and retrieving the last dict values are considered as the latest and in the exact order and no async like Ws on_order_update. I have noticed an out of order issue while polling order status today after 3 pm.
1 . Is WS on_order_update faster than the conventional polling method? Or both are updating at the same time? 2. Is there any possibility of having a flakeout while polling for order updates? 3. Is it possible to depreciate the polling method in the future, as I am considering switching from WS order updates to conventional polling for certain use cases?
orderstatus = order_history[-1]['status']
if this is COMPLETE then go ahead
eg: If we use this approach, history[-1]['status'], will I get the latest order status in an exact order?
Yes, the last item in the order history gives you the latest status of the order. You may also fetch orderbook and find by order_id and check the status.
orderstatus = order_history[-1]['status']
If fetching the order book and retrieving the last dict values are considered as the latest and in the exact order and no async like Ws on_order_update. I have noticed an out of order issue while polling order status today after 3 pm.
1 . Is WS on_order_update faster than the conventional polling method? Or both are updating at the same time?
2. Is there any possibility of having a flakeout while polling for order updates?
3. Is it possible to depreciate the polling method in the future, as I am considering switching from WS order updates to conventional polling for certain use cases?