☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
153
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
403
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
August 2020
rakeshr
August 2020
Appytraders
ReactorNotRestartable
Appytraders
August 2020
in
Python client
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
Tagged:
#python #ticker #marketdata
Appytraders
August 2020
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
August 2020
Are you using Anaconda environment?
You can through
python client Websocket FAQs
.
Sign In
or
Register
to comment.
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()
You can through python client Websocket FAQs.