It looks like you're new here. If you want to get involved, click one of these buttons!
# Initialise
kws = KiteTicker(API_KEY, ACCESS_TOKEN)
def on_ticks(ws, ticks):
# Callback to receive ticks.
logging.debug("Ticks: {}".format(ticks))
def on_connect(ws, response):
# Callback on successful connect.
ws.subscribe([857857])
# Set XX to tick in `full` mode.
ws.set_mode(ws.MODE_QUOTE, [857857])
def on_close(ws, code, reason):
# On connection close stop the main loop
# Reconnection will not happen after executing `ws.stop()`
ws.stop()
# 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()