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)
insert_tick(ticks)
return
def on_connect(ws, response):
# Callback on successful connect.
sub_token=get_subscribe_list()
# Subscribe to a list of instrument_tokens.
ws.subscribe(sub_token)
# Set to tick in `full` mode.
#ws.set_mode(ws.MODE_FULL, sub_token)
return
def on_close(ws, code, reason):
# On connection close stop the main loop
# Reconnection will not happen after executing `ws.stop()`
print('Close ','code:',code,'reason:',reason)
ws.stop()
return
def on_error(ws, code, reason):
print('Error ','code:',code,'reason:',reason)
return
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.on_error = on_error
# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()
Thanks
insert_tick
method.Also, you shouldn't call insert _tick inside on_tick method, use multithreading instead. Check the example here.
If we search for 1006 in this page I think the internet connection thing gets confirmed.