import requests url = "https://api.kite.trade/instruments" row = str(requests.get(url).content, 'utf-8').split("\r\n") head = row[0].split(",") data = [cell.split(",") for cell in row[1:-1]] instrument_token = "738561" #reliance
# here tick contains market data from websocket connection for i in data: if tick["instrument_token"] == instrument_token : print (i[head.index("tradingsymbol")])
However searching though ~ 60k rows on every tick is not very efficient, therefore i store the tradingsymbol in a list, before connecting to websocket.
Thanks @ridhi_karan , @rakeshr, @sujith by using websocket response can i get market depth in "Buy" side and "Sell" side? Previously there was 'depth.buy', 'depth.sell' columns was there. No is it removed?
url = "https://api.kite.trade/instruments"
row = str(requests.get(url).content, 'utf-8').split("\r\n")
head = row[0].split(",")
data = [cell.split(",") for cell in row[1:-1]]
instrument_token = "738561" #reliance
# here tick contains market data from websocket connection
for i in data:
if tick["instrument_token"] == instrument_token :
print (i[head.index("tradingsymbol")])
However searching though ~ 60k rows on every tick is not very efficient, therefore i store the tradingsymbol in a list, before connecting to websocket.
@rakeshr, @sujith by using websocket response can i get market depth in "Buy" side and "Sell" side? Previously there was 'depth.buy', 'depth.sell' columns was there. No is it removed?
Use full mode to get market depth
ws.set_mode(ws.MODE_FULL,subscribe)