Order Updates not coming in sequence

dhananjaya
Hi,

This is in continuation of https://kite.trade/forum/discussion/8051/receiving-update-status-postback-call-after-complete

Many a times I had seen by order been open in my database even when the order was complete. Further debugging revealed that the COMPLETE status is coming before UPDATE and hence status is getting reverted back to OPEN

Also the timestamp fields are not in correct sequence. If they are correct, may be I can ignore the older updates.
This effectively makes using Order update unusable.

Can someone take a look at it.

Below is the trail

INFO: onOrderUpdate setOnOrderUpdateListener 2020-09-08 15:07
Sep 08, 2020 3:07:52 PM com.quantsiri.feeds.kite.KiteWrapper$2 onOrderUpdate
INFO: onOrderUpdate setOnOrderUpdateListener 2020-09-08 15:07
Obj received for addOnOrderUpdateListener XOrder{contract=NIFTY20SEPFUT, ordTime=Tue Sep 08 15:07:49 IST 2020, buySell=BUY, ordQty=75.0, ordType=MKT, algo=null, trdTime=Tue Sep 08 15:07:49 IST 2020, exeStatus=COMPLETE, exeQty=75.0, rank=null, ordPrice=0.0, symbol=NIFTY20SEPFUT, orderKey=null, strategy=null, accType=Live, broker=Zerodha}
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder
INFO: Coming into Order Update from: Listener Orderid: 200908201490565
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder
INFO: SQL1: UPDATE TB_ORDERS SET STATUS='COMPLETE', FILLED_QTY=75.0, EXE_TIME='2020-09-08 15:07:53.474', FILLED_PRICE= 11332.3, STOP=null, STOPLMT =null WHERE ACC_NAME ='RD3961' AND ORDERID='200908201490565' and ACC_TYPE='Live'
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder
INFO: Update Count: 1
OnOrderUpdateCommand dataObjectReceived
Obj received for addOnOrderUpdateListener XOrder{contract=NIFTY20SEPFUT, ordTime=Tue Sep 08 15:07:49 IST 2020, buySell=BUY, ordQty=75.0, ordType=MKT, algo=null, trdTime=Tue Sep 08 15:07:49 IST 2020, exeStatus=OPEN, exeQty=0.0, rank=null, ordPrice=0.0, symbol=NIFTY20SEPFUT, orderKey=null, strategy=null, accType=Live, broker=Zerodha}
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder
INFO: Coming into Order Update from: Listener Orderid: 200908201490565
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder
INFO: SQL1: UPDATE TB_ORDERS SET STATUS='OPEN', FILLED_QTY=0.0, EXE_TIME='2020-09-08 15:07:53.49', FILLED_PRICE= 0.0, STOP=null, STOPLMT =null WHERE ACC_NAME ='RD3961' AND ORDERID='200908201490565' and ACC_TYPE='Live'
Sep 08, 2020 3:07:53 PM com.quantsiri.dbo.DBPopulate updOpenOrder

Regards
Dhananjaya
  • rakeshr
    @dhananjaya
    As already stated by @sujith in the previous post, that these post-back order updates are async calls. So, there can be instances of mismatch in sequence. You need to handle them at your end.
    Maybe have a little buffer period at your end and then perform any DB updates/other processes, after sorting by required field(time, etc) as per your requirement. Or maybe ignore any further postback feed post COMPLETE status for that specific order.
  • dhananjaya
    I can understand if they are asynch calls and may not come in sequence.
    But please pray help me understand how I can handle at my end if the timestamps are not correct in that order.
  • sujith
    @dhananjaya,
    We just forward the update as received by the OMS. If the timestamp is not correct then I would suggest check for some other method. Maybe once you see the complete status, you can fetch orderbook and check.
Sign In or Register to comment.