Is it triggered on every update to an order status of a particular order? So all the way from pending, to open to complete, I will get an update for every status - immidiately after it happens?
This can also be used to get the latest positions, and order_ids without any risk of getting the "HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)" error as with polling kite.positions() right?
You will receive order update only when there is a partial fill, or trigger is hit or order is modified. You can use that as an event to fetch and update orderbook and positions.
@SRIJAN When you say its asynchronous, do you mean that an order is placed, its open and then complete, I might get complete as an update first and then open?
I see. If thats the case then just calling kite.order_history(order_id) seems easier? @SRIJAN And following this, this means that it still cant be fully relied upon as a position tracker, am I right?
At the end,it's your choice. In your case,you said you place limit orders,then websocket updates would be better beacuse it will update you directly when the order is filled,but through order_history(),you have to call it every few seconds to check if order is filled. Also,as Sujith Sir said,you should use websocket update as an event to fetch orderbook and update positions.
Since you're recommending websockets @SRIJAN as a viable alternative (which I will be happy to use btw, since it has less chance to throw the timeout error), kindly explain how do I go about actually implementing it when it is asynchronous? My algo does different things depending upon what the order status is and if the incoming value is not accurate, you can see how its of no point? Or is it that I just have a limited understanding of the websocket update?
Sujith Sir already told. Use websocket update as an event to fetch orderbook and update positions. Whenever you get an update, instead of looking at it's status ,call order history and check the latest status from there.
I did place this in the algo today and initialised it with this kws.on_order_update = on_order_update. Yet there's nothing. No log entered in my log file as the "data" and on_order_update_list is empty. What could have happened here?
It is an event that is triggered when there is a change in order like partial fill, order modified, trigger is hit etc. It is not an orderbook fetch. So you won't receive a orderbook response on connecting to Kite Ticker.
You will receive order update for an order when it is executed also so, if you place an order that gets rejected will also trigger this on_order_update. But make sure you won't abuse it (place too many rejected orders continuously) otherwise RMS might get flag your app as spam.
@sujith This is my on_order_update. I have also initialised it with buts not been working since the last time posted here. You have said that I will receive an update when its executed, but I am still getting nothing. There is no "data" from the on_order_update in my logs and on_order_update_list remains empty.
I want to check the order_history(order_id) when there is an update via the on_order_update(), as you recommended earlier, but this is making be unable to. Please help.
And following this, this means that it still cant be fully relied upon as a position tracker, am I right?
Please guide
I did place this in the algo today and initialised it with this
kws.on_order_update = on_order_update.
Yet there's nothing. No log entered in my log file as the "data" and on_order_update_list is empty. What could have happened here?
It is not an orderbook fetch. So you won't receive a orderbook response on connecting to Kite Ticker.
But make sure you won't abuse it (place too many rejected orders continuously) otherwise RMS might get flag your app as spam.
This is my on_order_update. I have also initialised it with buts not been working since the last time posted here. You have said that I will receive an update when its executed, but I am still getting nothing. There is no "data" from the on_order_update in my logs and on_order_update_list remains empty.
I want to check the order_history(order_id) when there is an update via the on_order_update(), as you recommended earlier, but this is making be unable to. Please help.
And make sure you are connected to Kite Ticker with the same client id.