It's working now I had given the wrong API key
please check the API key once @nayan_nandi
M
Manoj Kathare
@Manoj Kathare
0
Reputation
3
Posts
1
Profile views
0
Followers
0
Following
Best posts made by Manoj Kathare
This user hasn't posted anything yet.
Latest posts made by Manoj Kathare
-
RE: Facing problem when streaming the live data
-
RE: Facing problem when streaming the live data
WebSocket
from smartapi import SmartConnect
from smartapi import WebSocket
obj=SmartConnect(api_key="my_key")
data = obj.generateSession('Client_id', 'Pass')
feedToken=obj.getfeedToken()
FEED_TOKEN=feedToken
CLIENT_CODE="Client_id"
token="nse_cm|2885" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
task="dp" #"mw"|"sfi"|"dp"
ss = WebSocket(FEED_TOKEN, CLIENT_CODE)def on_tick(ws, tick):
print("Ticks: {}".format(tick))def on_connect(ws, response):
ws.websocket_connection() # Websocket connection
ws.send_request(token,task)def on_close(ws, code, reason):
ws.stop()Assign the callbacks.
ss.on_ticks = on_tick
ss.on_connect = on_connect
#ss.on_close = on_closess.connect()
print(tick) -
RE: Facing problem when streaming the live data
@nayan_nandi I am also facing the same problem
if it is fixed on your side please let me know