how to get nifty and banknifty quotes ?

print(kite.quote(['NSE:NIFTY'])) prints empty list . While this works for other symbols like INFY . How to get nifty and banknifty quote ?
  • rakeshr
    Are you looking to fetch quote data for NIFTY 50 indices?
    Then, instead it should be 'NSE:NIFTY 50'.
    You can fetch complete trading instrument list from here. Look for exchange and tradingsymbol field and use the same to fetch Quote data i.e exchange:tradingsymbol .
  • rohitm
    yeah that worked. But is there a way to give trading symbol here dynamically using a variable ? like below doesn't recognise CE_strike_symbol though that is a variable having actual symbol name

  • rakeshr
    Here, CE_strike_symbol is recognized as string rather than variable. As, you have mentioned it inside string quote. Instead, you may try:
    You can refer to this article to know more about python string formatting.
  • rohitm
    thanks Rakesh . kite.ohlc(["NFO:" + CE_strike_symbol]) worked
This discussion has been closed.