kite.quote not returning value on a loop

A_Ahuja
Hi, I am trying to run a program to fetch the quotes for a list of instruments. When I run the program for just one list element I get a result "{}" but when I create a separate list of the same elements I get the result, could someone please help me figure out what I am doing wrong? I am a bit rusty in python. Sharing the code pack below:

kite.set_access_token(kite_access_token)

x = kite.quote('NSE:20MICRONS','NSE:21STCENMGM','NSE:3IINFOTECH','NSE:3MINDIA','NSE:3PLAND') #For testing if the API allows for 5 instruments
pprint(x)
stocks = pd.read_csv('EQUITY_L.csv') #contains the list of all the equities in NSE
print('Zerodha start:')
print(datetime.datetime.now())
symbol_groups = list(chunks(stocks["'NSE:SYMBOL'"],5)) #NSE:SYMBOL column has all the instruments in the format: 'NSE:', including the quotes

for i in range(0,len(symbol_groups)):
symbol_strings.append(",".join(symbol_groups[i]))

for symbol_string in symbol_strings[:1]:
print(symbol_string)
k = kite.quote(symbol_string)
pprint(k)
# for symbol in symbol_string.split(','):

print(datetime.datetime.now())
  • A_Ahuja
    @sujith could you please help me with this?
  • rakeshr
    @A_Ahuja
    Didn't get you ?
    x = kite.quote('NSE:20MICRONS','NSE:21STCENMGM','NSE:3IINFOTECH','NSE:3MINDIA','NSE:3PLAND') #For testing if the API allows for 5 instruments
    pprint(x)
    So, you are getting empty pprint output for this?
    Code looks fine.
  • A_Ahuja
    Hi @rakeshr, the issue has been resolved. Thank you for your response.
This discussion has been closed.