Time lag between Exchange Time and System Time from v5 relese

Dileep
Hi .. In two different instance of AWS i am running instance1 with V 4.2.0 and instance2 with V5(Latest kite connect). I am observing time lag in the latest version of kite connect. I doubt have you introduced any queue concept in websocket? After the heavy computation in the "def on_ticks(ws,ticks):" method connection is not dropping and in the next tick i am getting the next old tick data.

But i did not observe any time lag in V4.2.0.(Here connection is dropping after the computation and re connecting it again.)
What code changes i need to do in V5 to run my code perfectly with exchange time.and fetch olny the latest ticks.

this is my below code:
def on_ticks(ws,ticks):
for tick in ticks:
#Doing some heavy computation of the data for further purpose
#......
ET=tick.get("exchange_timestamp")
logging.debug('ET => '+str(ET))
dnow = datetime.datetime.now().strftime('%H%M%S')
logging.debug('CurrentTime => '+str(dnow))

def on_connect(ws, response):
ws.subscribe(FandOInstrumentsSubscribe)
ws.set_mode(ws.MODE_FULL,FandOInstrumentsSubscribe)
def on_close(ws, code, reason):
# On connection close stop the main loop
# Reconnection will not happen after executing `ws.stop()`
ws.stop()

kws.on_ticks = on_ticks
kws.on_connect = on_connect
#kws.on_error = on_error
kws.connect()
kws.on_close = on_close
  • rakeshr
    I doubt have you introduced any queue concept in websocket?
    No, no changes in the ws implementation. You can go through the version change log here.
    I just tried the time lag between exchange time and system time for NIFTY 50 index(256265) on the lastest Version: 5.0.1, and no noticeable lag was seen.
  • Dileep
    Dileep edited August 7
    Hi Rakesh.. Thanks for your quickk response. Please find the attached log file. I attached the log file between "13:38:23" to "14:02:24" . In the starting of the log you can see the time differnece is around just 5 to 10 seconds. While you reach end of the log file the time gap is keep on increasing and in the end it is around 5 minutes(300 seconds). And it is working fine in version V4.2.0( Just 5 to 10 seconds). at any time.Please have a lookk and fix it.
    Do some computation in def on_ticks(ws,ticks):
    I am not getting the erorr in V5 "kiteconnect.ticker - ERROR - Connection error: 1006 - connection was closed uncleanly (None)" after computation.
    @rakeshr @sujith
  • Dileep
    HI @rakeshr can you subscribe for whole option chain and try it.
  • rakeshr
    it is working fine in version V4.2.0( Just 5 to 10 seconds). at any time.Please have a lookk and fix it
    As I mentioned before, there are no changes to fix.
    can you subscribe for whole option chain and try it.
    There are many systems that do it. You need to debug the buffer at your end. There are no changes in the public SDK, as you can see your self.
Sign In or Register to comment.