How to fetch banknifty spot data using ltpData()


  • The following code is giving None data.
    obj.ltpData(exchange='NSE', tradingsymbol='Nifty Bank', symboltoken='99926009')


  • def get_ltp(self, ticker, exchange="NSE", fake=False):
    
    
        symbol = self.trading_symbol_form(ticker)
        params = {
            "exchange": exchange,
            "tradingsymbol": symbol,
            "symboltoken": angel_inst.token_lookup(symbol, exchange)
        }
        # print(params)
        response = self.smart_obj.ltpData(params['exchange'], params['tradingsymbol'], params['symboltoken'])
        return response['data']['ltp']

  • @Vikram_Sai def get_ltp(self, ticker, exchange="NSE", fake=False):

        symbol = self.trading_symbol_form(ticker)
        params = {
            "exchange": exchange,
            "tradingsymbol": symbol,
            "symboltoken": angel_inst.token_lookup(symbol, exchange)
        }
        # print(params)
        response = self.smart_obj.ltpData(params['exchange'], params['tradingsymbol'], params['symboltoken'])
        return response['data']['ltp']