How to get live price data?
-
I have been trying it for last 2 days but I am not able to fetch it. Please anyone give code @admin
-
Have a looks the document..
https://smartapi.angelbroking.com/docs/WebSocket
You can get your token for instruments here
https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json
-
@rjbanna could you please tell me what are the various categories of the feed possible.
nse_cm -> cash market
what are the classifications for future markets and commodities/? -
@smartarman Here's the code
CLIENT_ID = 'CLIENT_ID' obj = SmartConnect(api_key="API_KEY") data = obj.generateSession(CLIENT_ID, "PASSWORD") refreshToken = data['data']['refreshToken'] FEED_TOKEN = obj.getfeedToken() token = 'cde_fo|1814' ss = WebSocket(FEED_TOKEN, CLIENT_ID) def on_tick(ws, ticks): print(ticks) def on_connect(ws, response): print("on connect") ws.send_request(token) def on_close(ws, code, reason): print("on close") ws.stop() ss.on_ticks = on_tick ss.on_connect = on_connect ss.on_close = on_close ss.connect()
-
now i am getting this output where is the price:-
Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:19'}]
Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:20'}]
Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:21'}] -
client id id what you use in your normal login to trade.angelbroking.com. API key is what you get from the https://smartapi.angelbroking.com. There is no use of secret key in this process yet. So you can ignore them for time being.
You need to generate feed token like how its given in the GitHub page and use it for web sockets.
-
@rajanprabu is the feed token = scret key and client id = API key
-
Hi @rajanprabu
The code mentioned at:
https://github.com/angelbroking-github/smartapi-pythonDoes contain two parts:
Part 1:
Ordering through APIPart 2:
Ordering through Websocketsam I correct?
-
-
@rajanprabu in that sample code i am not able to understand where to put the scrip name to get the data
-
-
@smartarman IN PYTHON