Navigation

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

    Difference between FEED_TOKEN and token

    Python SDK
    3
    12
    106
    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.
    • S
      Surya 1 @mandeepV last edited by

      @mandeepV

      you need to generate them..

      https://github.com/angelbroking-github/smartapi-python

      M 2 Replies Last reply Reply Quote 0
      • M
        mandeepV @Surya 1 last edited by

        @rajanprabu Thanks. Working now.

        I used following variable for FEED_TOKEN's value at bottom.

        #fetch the feedtoken
        feedToken=obj.getfeedToken()
        
        D 1 Reply Last reply Reply Quote 0
        • M
          mandeepV @Surya 1 last edited by

          @rajanprabu I receive 3 ticks, do you know how they differ?

          Ticks: [{'name': 'tm', 'tvalue': '24/02/2021 10:04:09'}]
          Ticks: [{'e': 'nse_cm', 'ltp': '2046.15', 'ltq': '16', 'ltt': 'NA', 'name': 'sf', 'tk': '2885'}]
          Ticks: [{'ap': '2046.93', 'bp': '2046.10', 'bq': '22', 'bs': '21', 'c': '2023.45', 'cng': '22.65', 'e': 'nse_cm', 'lo': '2026.15', 'ltp': '2046.10', 'ltq': '1', 'ltt': '24/02/2021 10:04:09', 'name': 'sf', 'nc': '01.12', 'sp': '2046.15', 'tbq': '384403', 'tk': '2885', 'to': '4707730213.14', 'tsq': '546250', 'v': '2299898'}]
          
          S D 2 Replies Last reply Reply Quote 0
          • S
            Surya 1 @mandeepV last edited by

            @mandeepV They are correct.. it normally gives tvalue once a second and 2-3 price ticks in a second. I search for keys. Have a look at this post by our 007

            https://smartapi.angelbroking.com/topic/329/working-websocket-sample-code-to-retrieve-ltp-python?_=1614176894000

            1 Reply Last reply Reply Quote 0
            • D
              djdenish @mandeepV last edited by

              @mandeepV
              I dont know hot to put feed token Can you share your working code??

              S 1 Reply Last reply Reply Quote 0
              • S
                Surya 1 @djdenish last edited by

                @djdenish

                from smartapi import SmartConnect 
                
                obj=SmartConnect(api_key="your api key")
                
                data = obj.generateSession("Your Client ID","Your Password")
                refreshToken= data['data']['refreshToken']
                
                #fetch the feedtoken
                feedToken=obj.getfeedToken()
                
                D 1 Reply Last reply Reply Quote 0
                • D
                  djdenish @Surya 1 last edited by

                  @rajanprabu
                  Do I have to put anything in the refresh token??
                  Or I just leave it as it is?

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Surya 1 @djdenish last edited by

                    @djdenish

                    refresh token is generated when you generate session.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      djdenish @Surya 1 last edited by djdenish

                      @rajanprabu

                      It shows invalid refresh token when I run below code.

                      import http.client
                      import mimetypes
                      conn = http.client.HTTPSConnection(
                      " apiconnect.angelbroking.com "
                      )
                      payload = ''
                      headers = headers = {
                      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
                      'Accept': 'application/json',
                      'X-UserType': 'USER',
                      'X-SourceID': 'WEB',
                      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
                      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
                      'X-MACAddress': 'MAC_ADDRESS',
                      'X-PrivateKey': 'API_KEY'
                      }
                      conn.request("GET",
                      "/rest/secure/angelbroking/user/
                      v1/getProfile",
                      payload,
                      headers)
                      res = conn.getresponse()
                      data = res.read()
                      print(data.decode("utf-8"))

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        Surya 1 @djdenish last edited by

                        @djdenish

                        I dont use the headers myself. I just use the python SDK. so I am unable to step in here to help you out.

                        1 Reply Last reply Reply Quote 0
                        • D
                          djdenish @mandeepV last edited by

                          @mandeepV
                          Can you share code of your screen shot??

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