I am using node.js client for my project. While the order placement flow is fairly straight forward, I have few doubts about the order updates that we receive through the websocket. I have gone through documentation but could not figure these out.
1. What does the status `UPDATE` mean? When is it received? 2. What would be the status when the order is partially filled? Will it be `OPEN`? 3. Is it possible that some updates are not sent over websocket postbacks? 4. If I have 3 instances of KiteTicker active and if I chose to subscribe to websocket postbacks on all 3 of them, will I get the same event 3 times? 5. In my logic for handling async order updates, I am treating `COMPLETE`, `REJECTED`, `CANCELLED` as terminal statuses and any events after reaching this status are simply ignored. Is this correct?
There are few edge cases wherein order updates are received twice. The solution is to use this as an event to fetch orderbook and look for the latest status of the order and filled quantity for partial fill. An UPDATE status could be partial fill or order modified or not modified or trigger hit. Order update is sent for all the orders for that account. User doesn't have to subscribe for the order updates, these are event just streamed from Kite Trade. If user has opened 3 websocket connections then you will receive order updates on all of them. You may include LAPSED also with the three statuses which may happen in the rear scenario when there is an issue and order is stuck at pending state and later exchange wants us to lapse those orders. Order id field is immutable, it won't change on modifying an order.
@sujith I happened to check this and I seem to receive postbacks over websockets for all the orders. However there is still a fair bit of discrepancy in reconciliation. Is it possible that I am getting postback event even before I am getting a response from the placeOrder API? I am assuming since placeOrder is a HTTP call, it would have significant latency as compared to websocket.
If yes, perhaps I can add a delay while processing the postback responses.
@sujith I tested this out today in the second half of the trading window. It is indeed happening that postbacks are received earlier than the placeOrder api response.
Is there a provision to send orders over websockets?
Order update is sent for all the orders for that account.
User doesn't have to subscribe for the order updates, these are event just streamed from Kite Trade. If user has opened 3 websocket connections then you will receive order updates on all of them.
You may include LAPSED also with the three statuses which may happen in the rear scenario when there is an issue and order is stuck at pending state and later exchange wants us to lapse those orders.
Order id field is immutable, it won't change on modifying an order.
If yes, perhaps I can add a delay while processing the postback responses.
Is there a provision to send orders over websockets?