❗❗❗ How to get tick data of BID PRICE, ASK PRICE ❗❗❗
-
@James-Bond
Ok let me check. -
I'm able to get Bid and Ask price successfully with same code. Can you check your credentials one more time ?
I once faced same issue which is primarily because of wrong credentials I'm using.
-
@James-Bond
WS = WebSocket(FEED_TOKEN, CLIENT_CODE)
TypeError: init() missing 1 required positional argument: 'task' -
from smartapi import SmartConnect from smartapi import WebSocket obj=SmartConnect(api_key="api_key") data = obj.generateSession('clientId','password') feedToken=obj.getfeedToken() FEED_TOKEN= feedToken CLIENT_CODE= 'clinetId' # SBIN token="nse_cm|3045" WS = WebSocket(FEED_TOKEN, CLIENT_CODE) def on_tick(ws, tick): for i in tick: if 'bp' in i.keys(): print(f"Buying Price: {i['bp']} \t Selling Price: {i['sp']}") def on_connect(ws, response): ws.send_request(token) def on_close(ws, code, reason): ws.stop() # Assign the callbacks. WS.on_ticks = on_tick WS.on_connect = on_connect WS.on_close = on_close WS.connect()
-
@James-Bond
Why your post gets deleted??❗❗❗ -
This post is deleted! -
@rajanprabu
Can you share code screen shot? -
Those come in the websockets along with price information. You need to look for bp and sp keys in the websocket stream. This works pretty well. I use it everyday..
-
@James-Bond
Just best buy and best sell price. -
You want complete 5 level depth or just Best Bid and Offer Price ?