@gaurang
instrument_url = 'https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json'
response = urllib.request.urlopen(instrument_url)
instrument_list = json.loads(response.read())
def token_lookup(ticker, exchange='NSE'):
for i in instrument_list:
if i['symbol'] == ticker and i['exch_seg'] == exchange:# and i['symbol'].split('-')[-1] == 'EQ':
return i['token']
token_lookup('NIFTY50')
def symbol_lookup(token, exchange='NSE'):
for i in instrument_list:
if i['token'] == token and i['exch_seg'] == exchange and i['symbol'].split('-')[-1] == 'EQ':
return i['name']