Unable to see any Quote Data from WEBSOCK streaming

seshank
I am unable to find any web sock streaming data currently getting printed into the terminal. To my knowledge I am using the latest version of kite connect module. I have shifted to Web socket streaming as there are issues with reconnection with kite.quote in KiteConnect. I previously used the Web sock streaming module but found no such difficulties in getting ticks data. My code for web sock streaming is as follows .


kws=KiteTicker(api_key=api_key,access_token=access_token,debug=True)
tokens = [54650119]

# Callback for tick reception.
def on_ticks(ws, ticks):
logging.debug("Ticks: {}".format(ticks))
print(ticks)
# for tick in ticks:
# if tick!=None:
# # logging.debug("Ticks: {}".format(tick))
# # print(ticks)
# data.send(ticks)
# data.close()

# Callback for successful connection.
def on_connect(ws, response):
logging.debug("on connect: {}".format(response))
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL, tokens)


def on_close(ws, code, reason):
logging.error("closed connection on close: {} {}".format(code, reason))


def on_error(ws, code, reason):
logging.error("closed connection on error: {} {}".format(code, reason))


def on_noreconnect(ws):
logging.error("Reconnecting the websocket failed")


def on_reconnect(ws, attempt_count):
logging.debug("Reconnecting the websocket: {}".format(attempt_count))


def on_order_update(ws, data):
print("order update: ", data)


# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_error = on_error
kws.on_noreconnect = on_noreconnect
kws.on_reconnect = on_reconnect
kws.on_order_update = on_order_update
# print(message)
# kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)

# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
# kws.connect(disable_ssl_verification=True)

kws.connect()


Kindly suggest
Sign In or Register to comment.