Unable to get live feed.
-
@admin I am not clear what needs to be entered in AUTH_TOKEN and correlation_id. Couldnt find anything on the documentation as well.
Please help
-
@admin - found answers to my question on documentation here https://drive.google.com/drive/u/0/folders/1GMwTMfxRdiloUziV4DYwlYchGXbOvTfL
follow up question : for AUTH_TOKEN, its mentioned (jwt auth token received from Login API). How do we generate auth token login api?
-
@admin - is AUTH_TOKEN same as Secret-Key ?
-
@Sukhwant280 can you elaborate your Q? with part of code or function and its error or output
-
@Mnagesh - Below is the code form websocket vs 2
my question is from where do we get AUTH_TOKEN. I tried adding "Secret-Key" from "Apps & API" section (i.e. this link -> https://smartapi.angelbroking.com/apps) but I get below feeds from websocket.
Code
from SmartApi.smartWebSocketV2 import SmartWebSocketV2AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzU-w'
API_KEY = 'qwert'
CLIENT_CODE = 'X123456'
FEED_TOKEN = '00998877'correlation_id = "nishant_123_qwerty"
action = 1
mode = 3Websocket feed:
In on pong function==> b'\x00' -
Hi @Sukhwant280 , Auth_token is JWT token obtained at the time of generating the session using loginbypassword api call.
-
@admin - Thanks. Now I am using below in my code
AUTH_TOKEN -> jwtToken from response from generateSession('userid', 'password')
FEED_TOKEN -> refreshToken from response from generateSession('userid', 'password')Please confirm if above is not correct, coz still I am getting same response from websockt i.e "Attempting to resubscribe/reconnect...
In on pong function==> b'\x00'"I tried to troubleshoot from my end -> it failing at below step (i.e. row no 310 in smartWebsocketV2.py:
"token": SmartWebSocketV2._parse_token_value(binary_data[2:27]),
Can you help me here to understand whats wrong in my inputs ?
-
Hi @Sukhwant280
FeedToken is different from refreshToken
jwtToken, refreshToken and feedToken are generated after successful login into your account via SmartAPI.
feedToken is required to be passed to a WebSocket connection request to start successful streaming of tick data.
Please read more about this in our documentation.
-
@admin
I get below response from generateSession. I cant find any relevant for FEED_TOKEN.{"status": True,
"message": "SUCCESS",
"errorcode": "",
"data": {
"clientcode": "XXXXXX",
"name": "XXXX YYYY",
"email": "",
"mobileno": "",
"exchanges": ["bse_cm", "nse_cm", "nse_fo"],
"products": ["BO", "NRML", "CO", "CNC", "MIS", "MARGIN"],
"lastlogintime": "",
"broker": "",
"jwtToken": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"refreshToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}Also, are you referring to below doc ? I cant find anything which explains which field to take from api response. Pleas advise
https://docs.google.com/document/d/1tZQzU2qNrB98eso6e6yqF3YxvXfK9cn5Xkzw_5jSJL8/edit -
@Sukhwant280 use this code for feedtoken
feedToken = obj.getfeedToken()