Zerodha Full Mode Tick Data Subscription Error Handling


While Full Mode is on, If we want to listen ticks of no volume instrument we are getting error from Kite that “Invalid argument” and getting out of code. Error details has been given below,

Kindly suggest, how to handle this exception from Kite side ?

Scenario of Problem:
While listening option chain , there are many strikes where no trades executed, then following error is throwing from Kite and we are out of code.

def on_connect(ws, response):
ws.set_mode(ws.MODE_FULL, token_list)

Assign the callbacks.

kws.on_ticks = on_ticks
kws.on_connect = on_connect

kws.on_close = on_close

Infinite loop on the main thread. Nothing after this will run.

You have to use the pre-defined callbacks to manage subscriptions.



Unhandled Error
Traceback (most recent call last):
File “\Programs\Python\Python36\lib\site-packages\twisted\python\", line 103, in callWithLogger
return callWithContext({“system”: lp}, func, *args, kw)
File "
\Programs\Python\Python36\lib\site-packages\twisted\python\", line 86, in callWithContext
return{ILogContext: newCtx}, func, *args, kw)
File "
\Programs\Python\Python36\lib\site-packages\twisted\python\", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, kw)
File "
\Programs\Python\Python36\lib\site-packages\twisted\python\", line 85, in callWithContext
return func(*args,kw)
— —
File "
\Programs\Python\Python36\lib\site-packages\twisted\internet\", line 149, in _doReadOrWrite
why = getattr(selectable, method)()
File "
\Programs\Python\Python36\lib\site-packages\twisted\internet\", line 205, in doRead
return self._dataReceived(data)
File "
\Programs\Python\Python36\lib\site-packages\twisted\internet\", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "
\Programs\Python\Python36\lib\site-packages\twisted\protocols\", line 330, in dataReceived
File "
\Programs\Python\Python36\lib\site-packages\twisted\protocols\", line 295, in _flushReceiveBIO
ProtocolWrapper.dataReceived(self, bytes)
File "
\Programs\Python\Python36\lib\site-packages\twisted\protocols\", line 120, in dataReceived
File "
\Programs\Python\Python36\lib\site-packages\autobahn\twisted\", line 131, in dataReceived
File "
\Programs\Python\Python36\lib\site-packages\autobahn\websocket\", line 1175, in _dataReceived
File "
\Programs\Python\Python36\lib\site-packages\autobahn\websocket\", line 1187, in consumeData
while self.processData() and self.state != WebSocketProtocol.STATE_CLOSED:
File "
\Programs\Python\Python36\lib\site-packages\autobahn\websocket\", line 1553, in processData
fr = self.onFrameEnd()
File "
\Programs\Python\Python36\lib\site-packages\autobahn\websocket\", line 1674, in onFrameEnd
File "
\Programs\Python\Python36\lib\site-packages\autobahn\twisted\", line 159, in _onMessageEnd
File "
\Programs\Python\Python36\lib\site-packages\autobahn\websocket\", line 627, in onMessageEnd
self._onMessage(payload, self.message_is_binary)
File "
\Programs\Python\Python36\lib\site-packages\autobahn\twisted\", line 162, in _onMessage
self.onMessage(payload, isBinary)
File "
****\Programs\Python\Python36\lib\site-packages\kiteconnect-3.7.0b10-py3.6.egg\kiteconnect\”, line 71,
in onMessage

File “********\Programs\Python\Python36\lib\site-packages\kiteconnect-3.7.0b10-py3.6.egg\kiteconnect\”, line 657,
in _on_message

File “********\Programs\Python\Python36\lib\site-packages\kiteconnect-3.7.0b10-py3.6.egg\kiteconnect\”, line 781,
in _parse_binary

builtins.OSError: [Errno 22] Invalid argument

ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing
Unhandled Error

Hey @babansfolio

Please post this in the Kite developer forum. One of our developers or other forum users will get help you out.

1 Like


Already posted few days back, no one is responding. If possible can you please contact other forum handlers from Zerodha side.