Is there need any aditional parameter to stream the F&O data???
-
I want to stream this scripts' data___
"64911": "TATAMOTORS29APR21FUT",
"64719": "ITC29APR21FUT",
"64815": "SAIL29APR21FUT"This is my code___
from smartapi import SmartConnect from smartapi import WebSocket import creds obj = SmartConnect(api_key=creds.api_key) # print(obj) data = obj.generateSession(creds.client_token, creds.password) refreshToken = data['data']['refreshToken'] # print(refreshToken) feedToken = obj.getfeedToken() # print(feedToken) userProfile = obj.getProfile(refreshToken) # print(userProfile) FEED_TOKEN = feedToken CLIENT_CODE = creds.client_token token = "nse_cm|64911&nse_cm|64719&nse_cm|64815" task = "mw" # "mw"|"sfi"|"dp" ss = WebSocket(FEED_TOKEN, CLIENT_CODE) trading_portfolios = {"64911": "TATAMOTORS29APR21FUT", "64719": "ITC29APR21FUT", "64815": "SAIL29APR21FUT"} def on_tick(ws, tick): print(tick) def on_connect(ws, response): ws.websocket_connection() ws.send_request(token, task) # Assign the callbacks. ss.on_ticks = on_tick ss.on_connect = on_connect ss.connect()
But when I trying to stream the data, it's printing something like this______
-
you need FnO data but using exchange as cash market.. for Fno data you need nse_fo.
token = "nse_fo|64911&nse_fo|64719&nse_fo|64815"
-
Hi @nayan_nandi can you please elaborate on which line of code you have passed your trading portfolio dictionary to receive data from web socket.