websocket Tick data problem
-
@admin Please help
from smartapi import WebSocket FEED_TOKEN= feedToken CLIENT_CODE="B165493" token= "nse_fo|59615" task="mw" #'mw'|'sfi'|'dp' ss = WebSocket(FEED_TOKEN, CLIENT_CODE) def on_tick(ws, tick): print("Ticks: {}".format(tick)) def on_connect(ws, response): ws.send_request(token,task) def on_close(ws, code, reason): ws.stop() ss.on_ticks = on_tick ss.on_connect = on_connect ss.on_close = on_close ss.connect( )
Getting this result
<function on_connect at 0x0000029E00FEE268> Ticks: [{'ak': 'nk', 'msg': 'mw', 'task': 'mw'}]
-
@rajanprabu said in websocket Tick data problem:
ws.websocket_connection()
@rajanprabu Thank you now it is working fine
-
you are missing
ws.websocket_connection()
.Give it a try with following code..
from smartapi import WebSocket FEED_TOKEN= feedToken CLIENT_CODE="B165493" token= "nse_fo|59615" task="mw" #'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() ws.send_request(token,task) def on_close(ws, code, reason): ws.stop() ss.on_ticks = on_tick ss.on_connect = on_connect ss.on_close = on_close ss.connect( )
-
Hi @balaji1212 can you specify which version of python SDK you are using.
-
Hi @balaji1212 web socket is working fine from our end.Please debug your code.