Data variation while fetching tick data for same script, same code, different accounts

YateshKandoi
KiteConnect version used:
github.com/zerodha/gokiteconnect/v4

Script Details:
Exchange = "MCX"
Segment = "MCX-FUT"
Name = "NATURALGAS"
InstrumentToken = 119257351
TradingSymbol = "NATURALGAS26JANFUT"
Expiry = "2026-01-27"

Scenario:
2 separate incidents, using same Go client for KiteConnect is being used to fetch the tick data. The code base is identical, the only difference is the different Zerodha Accounts. I typically start by script to fetch and work on my algo every trading day, between 8 AM - 8:45 AM.

Frequency of Scenario:
In the past 45 days of so, I have witnessed the variation the most, in the following 2 scenarios:
(a) If there is a gap in launching the code by more than 2 minutes
(b) If the code is launched somewhere between 8:10-8:20 AM

Example difference:
Here are the google drive links to the fetched data (in CSV format) for above mentioned script from January 14, 2026
- File 1 - https://drive.google.com/file/d/1EujY88GRV94iQTCZ-HYUxdpU-yn5HJAQ/view?usp=sharing
- File 2 - [with missing nearly 1200 entries] - https://drive.google.com/file/d/1ib93xAiVCfM2QqiT8-kC_vNjjQwC2GMb/view?usp=sharing

I am running my code on AWS spot instances, thought, my instance size was small, and perhaps there were memory leakages, but, have checked and have not been able to find any issues even after increasing the instance size so far. After much deliberation and with utter cluelessness - reaching out to the forum - in the hope to get help in fixing this issue; everyone understands - what would missed data means - a lot of missed/bad decisions by the algorithm.

Appreciate your attention to my query. Thank you.
  • Nivas
    We observed that File 2 stopped recording at 11:28 PM, which accounts for some of the discrepancy compared to File 1.

    Beyond the recording time, it’s important to note that WebSocket connections function independently. Since the ticker provides the latest market snapshot at the moment of broadcast, no two streams are guaranteed to be identical. Each socket captures its own 'slice' of market data, and because they don't synchronize with one another, variations in the tick count are a standard part of the streaming process.
  • YateshKandoi
    Thank you for the insight @Nivas .

    Since we can not guarantee similar snapshots for different WebSockets - would you have any recommendations - wherein, I can get the most of the snapshots without missing out on much irrespective of the number of websockets I deploy across various accounts?

    If there is something I can edit within the coding practices, or based on any recommendations that you may have - the only objective is to minimise the gap/differences.

    Any help would be greatly appreciated!
  • Nivas
    Minor gaps are inherent to WebSocket streaming, and exact parity across streams is not guaranteed by design.
This discussion has been closed.