☰
Login
Signup
Home
›
Market data (WebSockets)
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
14.5K
All Categories
0
Incidents
171
Node JS client
48
Go client
819
.Net API client
393
Kite Publisher
542
.Net / VBA / Excel (3rd party)
476
Algorithms and Strategies
1K
Java client
1.2K
API clients
408
PHP client
4.2K
Python client
354
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.5K
General
Not able to connect Websockets through Kite API -
manish_khosla
July 26
in
Market data (WebSockets)
Hi
can any one help me to correct or suggest how to connect websocket for personal analysis (i have valid API with 500 points as well)
from kiteconnect import KiteConnect, KiteTicker
API_KEY = "d9x8olz0kXXXXXXXX"
API_SECRET = "ubj7daxn49ge777jXXXXXXXXXX"
kite = KiteConnect(api_key=API_KEY)
# Paste your current request_token manually here
request_token = "cHSAElN14rfU2b1gq5vCdXXXXXXXXXX"
data = kite.generate_session(request_token, API_SECRET)
access_token = data["access_token"]
kite.set_access_token(access_token)
kws = KiteTicker(API_KEY, access_token)
def on_connect(ws, resp):
print("???? WS Connected")
ws.subscribe([738561])
ws.set_mode(ws.MODE_FULL, [738561])
def on_ticks(ws, ticks):
print("???? Ticks:", ticks)
kws.on_connect = on_connect
kws.on_ticks = on_ticks
kws.connect(threaded=True)
while True:
time.sleep(1)
Tagged:
Python Client
WebSocket
kiteapi
Sign In
or
Register
to comment.