def on_ticks(ws, ticks): # Callback to receive ticks. logging.debug("Ticks: {}".format(ticks))
def on_connect(ws, response): # Callback on successful connect. # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe([787969, 1698817]) #SHANTIGEAR, TATAINVEST-BE # Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_FULL, [1698817])
def on_close(ws, code, reason): # On connection close stop the event loop. # Reconnection will not happen after executing `ws.stop()` ws.stop()