Navigation

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

    ltpdata

    Python SDK
    0
    3
    12
    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.
    • M
      msuthar0157 last edited by

      please provide complete script of print LTP data

      S 1 Reply Last reply Reply Quote 0
      • S
        sati36 @msuthar0157 last edited by

        @msuthar0157
        you must have to first genrate a session and then you can simply add this line when you need to fetch LTP data

        LTP = self.obj.ltpData(self.EXCHANGE, script, token)
        LTP_price= LTP["data"]["ltp"]

        LTP_price will contain your LTP

        also you have to pass a 3 parameters as you can see

        1 Reply Last reply Reply Quote 0
        • A
          anuranaich last edited by

          Login to get session token

          try:
          data = smartapi.generateSession(client_id, pwd, totp_code)
          refresh_token = data['data']['refreshToken']
          access_token = data['data']['jwtToken']
          feed_token = smartapi.getfeedToken()
          print("Login Successful. Access Token:", access_token)

          except Exception as e:
          print("Login Failed:", e)

          stock_symbol_token_NIFTY = '99926000' # NIFTY token for NSE
          exchange_NIFTY = 'NSE'
          trading_symbol_NIFTY = 'NIFTY'

          stock_data_NIFTY = smartapi.ltpData(exchange_NIFTY, trading_symbol_NIFTY, stock_symbol_token_NIFTY)

          print(stock_data_NIFTY['data']['ltp'])

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