Zerodha Full Mode Tick Data Subscription Error Handling

Hello,

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.subscribe(token_list)
ws.set_mode(ws.MODE_FULL, token_list)
print(“on_connect”)

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.

kws.connect(threaded=True)

kws.connect()

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

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

File “********\Programs\Python\Python36\lib\site-packages\kiteconnect-3.7.0b10-py3.6.egg\kiteconnect\ticker.py”, 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
handshake)
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing
handshake)
on_connect
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

Hey,

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