It looks like you're new here. If you want to get involved, click one of these buttons!
import logging
from kiteconnect import KiteTicker
logging.basicConfig(level=logging.DEBUG)
def run():
kws = KiteTicker("your_api_key", "your_access_token")
def on_ticks(ws, ticks):
logging.debug("Ticks: {}".format(ticks))
def on_connect(ws, response):
ws.subscribe([738561, 5633])
ws.set_mode(ws.MODE_FULL, [738561])
def on_close(ws, code, reason):
ws.stop()
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
kws.connect(threaded=True)
while True:
#Perform required data operation using tick data
def on_ticks(ws, ticks):
..........
helper_method(ticks)
.........
def helper_method(ticks):
.........
Perform computation here
CHECK STOP_KITE IF TRUE. IF TRUE, CALL on_close()
#Assign callback
kws.on_ticks=on_ticks
assign callback
bot_handler(run)