It looks like you're new here. If you want to get involved, click one of these buttons!
def on_ticks(ws, ticks):
# Callback to receive ticks.
print(ticks)
def on_connect(ws, response):
# Callback on successful connect.
# Subscribe to a list of instrument_tokens (RELIANCE and ACC here).
print("Connection started")
ws.subscribe([13635586])
# # Set RELIANCE to tick in `full` mode.
# ws.set_mode(ws.MODE_FULL, instrument_token)
def on_close(ws, code, reason):
# On connection close stop the main loop
# Reconnection will not happen after executing `ws.stop()`
print("Connected stopped")
# ws.stop()
def on_order_update(ws, data):
print("Okay got data")
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_order_update = on_order_update
while True:
#Perform required data operation using tick data
def on_order_update(ws, ticks):
helper_method(ticks)
def helper_method(ticks):
print("Got tick, sleeping now")
time.sleep(5)
print("Slept")
#Assign callback
kws.on_order_update=on_order_update
Connection error: 1006 - connection was closed uncleanly (None)
Connection closed: 1006 - connection was closed uncleanly (None)