ReactorNotRestartable

Appytraders
ReactorNotRestartable Traceback (most recent call last)
in
29 kws.on_close = on_close
30
---> 31 kws.connect()

I did see a similar issue being posted earlier, but that did not resolve this problem. Please help
  • Appytraders
    Here's the code:

    import logging
    from kiteconnect import KiteTicker
    from pprint import pprint

    logging.basicConfig(level=logging.DEBUG)
    kws = KiteTicker(api_key, access_token)

    tportfolio = {14957314:"ACC20SEPFUT",13015042:"ACC20OCTFUT",12084994:"ACC20NOVFUT"}
    inst_token=[14957314,13015042,12084994]

    def on_ticks(ws, ticks):
    for single_com in ticks:
    inst_single_com = single_com["instrument_token"]
    name = tportfolio["inst_single_com"]
    print(single_com,name)

    #pprint(ticks)
    #print("\n")

    def on_connect(ws, response):
    ws.subscribe([inst_token])
    ws.set_mode(ws.MODE_LTP, [inst_token])

    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()
  • rakeshr
    Are you using Anaconda environment?
    You can through python client Websocket FAQs.
Sign In or Register to comment.