Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Re: How to fetch nifty spot data using ltpData()

    Python SDK
    0
    2
    64
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      piyushpk last edited by

      Re: How to fetch banknifty spot data using ltpData()

      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']
      
      J 1 Reply Last reply Reply Quote 0
      • J
        Jeet Pattani @piyushpk last edited by Jeet Pattani

        @piyushpk Try using the symboltoken as 26009 and tradingsymbol as BANKNIFTY. Except Nifty and BankNIFTY you cannot get the ltp from getLTP endpoint. Please do tell me if you are able to get other than these two.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post