Ticker service stopping around 1:30

shivateen
We are running ticker service fetching price for around 30 to 40 symbols through out the trading hours . However we are noticing that around 1:30 the ticker service stops and after restart it resumes. Has anyone faced this issue, how do we resolve
  • rakeshr
    Can you paste the stack trace of the disconnection?
  • shivateen
    We didn't receive any of the listener such as on_error, on_disconnect, on_reconnect etc., we don't find any errors or stack trace in our logs. The ticker alone stops sending updated data to our listener functions.
    Ticker listener code below :

    Zerodha Ticker Class Functions :

    def on_connect(self, ws, response):
    self.onConnect()

    def on_close(self, ws, code, reason):
    self.onDisconnect(code, reason)

    def on_error(self, ws, code, reason):
    self.onError(code, reason)

    def on_reconnect(self, ws, attemptsCount):
    self.onReconnect(attemptsCount)

    def on_noreconnect(self, ws):
    self.onMaxReconnectsAttempt()

    def on_order_update(self, ws, data):
    self.onOrderUpdate(data)

    SuperClass Fuctions :

    def onNewTicks(self, brokerTicks):
    try:
    for listener in self.tickListeners:
    listener(brokerTicks)
    except Exception as e:
    Utils.log.error('BaseTicker: Exception from listener callback function. Error => %s', str(e))

    def onConnect(self):
    Utils.log.info('Ticker connection successful.')

    def onDisconnect(self, code, reason):
    Utils.log.error('Ticker got disconnected. code = %d, reason = %s', code, reason)

    def onError(self, code, reason):
    Utils.log.error('Ticker errored out. code = %d, reason = %s', code, reason)

    def onReconnect(self, attemptsCount):
    Utils.log.warn('Ticker reconnecting.. attemptsCount = %d', attemptsCount)

    def onMaxReconnectsAttempt(self):
    Utils.log.error('Ticker max auto reconnects attempted and giving up..')

    TickerListener Function

    @staticmethod
    def tickerListener(brokerTicks):
    try :
    TradeManager.listenerQueue.put(brokerTicks)
    Utils.log.info(f'TradeManager: tickerListener ticks : {brokerTicks}')
    except Exception as e:
    Utils.log.error(f'TradeManager: tickerListener Exception Error {e}')


    I keep the ticker in a python queue service and another thread dequeue the ticker for every 0.5 sec and used to print the ticks in the logs. Today the ticker stops sending data after 11:53 itself. Receiving this kind of issue starting from March 2, 2023. Can you guys quickly check with this case.
  • shivateen
    Also updated my kiteconnect package to 4.2.0 and the same issue persists
  • rakeshr
    The ticker alone stops sending updated data to our listener functions.
    For disconnection, on_error is always called, so you need to make sure you are assigning proper callbacks for on_error.
  • shivateen


    @rakeshr Thanks for the quicker response.
    I used to receive this kind of msgs in the call back previously. callbacks are properly aligned in this case. Is there any other possibilities to find the root cause of the issue.
  • rakeshr
    Ticker errored out. Code=1006
    Looks like, the ticker main thread is blocked. Check for blocking of on_ticks calls. This thread explains more.
Sign In or Register to comment.