It looks like you're new here. If you want to get involved, click one of these buttons!
from kiteconnect import WebSocket
# Initialise.
kws = WebSocket("your_api_key", "your_public_token", "logged_in_user_id")
# Callback for tick reception.
def on_tick(tick, ws):
print tick
# Callback for successful connection.
def on_connect(ws):
# Subscribe to a list of instrument_tokens (RELIANCE and ACC here).
ws.subscribe([738561, 5633])
# Set RELIANCE to tick in `full` mode.
ws.set_mode(ws.MODE_FULL, [738561])
# Assign the callbacks.
kws.on_tick = on_tick
kws.on_connect = on_connect
kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)
# Infinite loop on the main thread. Nothing after this will run.
using the mentioned callbacks (on_tick).
So the ontick definition will handle that part