I am streaming live quotes using websockets for commodity futures on MCX. Seeing a whole lot of latency, and some ticks have extremely high latency e.g. from 6th Jan. Observed similar ticks yesterday as well.
MCXMETLDEX26JANFUT at 16:03:55, latency: 25435541 ms STEELREBAR26JANFUT at 16:03:55, latency:25435216 ms
Subscribing to data in FULL MODE using WebSocket API, please see the code below. self.tokens has ~1000 tokens across NSE, NCO and MCX. I am only seeing this latency issue with MCX instruments, and it is consistently high (not a one-time occurrence). Latency calculated as exchange time stamp - system timestamp.
def on_connect(self, ws, response): logger.info(“:green_circle: WebSocket Connected. Subscribing…”) chunk_size = 500 for i in range(0, len(self.tokens), chunk_size): batch = self.tokens[i:i + chunk_size] ws.subscribe(batch) ws.set_mode(ws.MODE_FULL, batch) logger.info(f":white_check_mark: Subscribed to {len(self.tokens)} tokens in FULL MODE.")
Are these bad ticks, or any issues with my code? Also, is it okay to loop through using chunks of 500?
There is a pattern; all of these occurrences are at 9:00 AM, and for some reason, my code is logging a timestamp of the moment when my websockets connection closes.
Incorrect to call it latency. System time zone is IST.
Also, I dont see the same issue for equity and equity futures, which are a part of the token list as well. Only observed an issue with MCX tokens, these specific ones on 6th Jan.
Since these securities have zero volume, the exchange is sending a consistent, unchanging tick throughout the day. We will check and notify the exchange about this pattern.
Kite Ticker publishes whatever data is published by the exchange. We don't modify or process anything so whatever you see is what the exchange is publishing.
Incorrect to call it latency. System time zone is IST.
Also, I dont see the same issue for equity and equity futures, which are a part of the token list as well. Only observed an issue with MCX tokens, these specific ones on 6th Jan.
COTTON26FEBFUT
COTTON26MARFUT
COTTONOIL26FEBFUT
COTTONOIL26JANFUT
COTTONOIL26MARFUT
KAPAS26FEBFUT
KAPAS26NOVFUT
MCXMETLDEX26FEBFUT
MCXMETLDEX26JANFUT
MCXMETLDEX26MARFUT
STEELREBAR26FEBFUT
STEELREBAR26JANFUT
STEELREBAR26MARFUT
Kite Ticker publishes whatever data is published by the exchange. We don't modify or process anything so whatever you see is what the exchange is publishing.