@admin
i have tried to fetch data of index but data is not receiveing properly
token = "nse_cm|26000&nse_cm|26009" # SAMPLE: nse_cm|2885&nse_cm|1594&nse_cm|11536&nse_cm|3045
token="mcx_fo|226745&mcx_fo|220822&mcx_fo|227182&mcx_fo|221599"
task = "sfi" # mw|sfi|dp
ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)
def on_message(ws, message):
print("Ticks: {}".format(message))
def on_open(ws):
print("on open")
ss.subscribe(task, token)
def on_error(ws, error):
print(error)
def on_close(ws):
print("Close")
Assign the callbacks.
ss._on_open = on_open
ss._on_message = on_message
ss._on_error = on_error
ss._on_close = on_close
ss.connect()
this is reponse i got
Ticks: [{'ak': 'ok', 'msg': 'connected', 'task': 'cn'}]
Ticks: [{'ak': 'ok', 'msg': 'sfi', 'task': 'sfi'}]
Ticks: [{'ak': 'ok', 'msg': 'sfi', 'task': 'sfi'}]
Ticks: [{'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb'}]
Ticks: [{'name': 'tm', 'tvalue': '26/07/2022 11:11:20'}]
Ticks: [{'name': 'tm', 'tvalue': '26/07/2022 11:11:21'}]
Ticks: [{'name': 'tm', 'tvalue': '26/07/2022 11:11:22'}]
Ticks: [{'name': 'tm', 'tvalue': '26/07/2022 11:11:23'}]
Error info: