From the documentation https://kite.trade/docs/connect/v3/websocket/#quote-packet-structure, the LTT (Last Traded Timestamp) & ExchangeTimestamp that we receive is int32 (4 bytes) and cannot accommodate epoch in millisecond granularity. Once we receive multiple ticks for the same second, it becomes difficult to identify which tick got executed first (not able to determine order in the payload, i.e., is in sequence or jumbled). It becomes easy if we get the same in millisecond granularity.
We receive a Unix timestamp in seconds from the exchange, which we convert to a Date object before passing it on to our clients. The exchange doesn't provide a timestamp in milliseconds, so we depend on the data they supply. However, you might consider adding a millisecond timestamp to each tick on your end to facilitate any necessary computations.
Thanks Nivas, I see that in the kiteconnect code, i.e., last_trade_time = datetime.fromtimestamp(self._unpack_int(packet, 44, 48)) It would be good if we can have `serverTimeStamp` from your end when sending the payload, something like `currentTs` in this link (https://upstox.com/developer/api-documentation/v3/get-market-data-feed/#live-feed). Anyway, I'll go ahead and add local received timestamp for each tick that I receive to maintain tick level granularity. Thanks.
last_trade_time = datetime.fromtimestamp(self._unpack_int(packet, 44, 48))
It would be good if we can have `serverTimeStamp` from your end when sending the payload, something like `currentTs` in this link (https://upstox.com/developer/api-documentation/v3/get-market-data-feed/#live-feed).
Anyway, I'll go ahead and add local received timestamp for each tick that I receive to maintain tick level granularity.
Thanks.