Navigation

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

    Unable to get live feed.

    Python SDK
    0
    16
    208
    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.
    • B
      balaSP @nehak last edited by

      @nehak During market hours, live data is coming.

      A 1 Reply Last reply Reply Quote 0
      • A
        admin @balaSP last edited by

        @balaSP @nehak Please use Websocket 2.0 - https://smartapi.angelbroking.com/topic/1861/user-feedback-websocket-2-0-beta-rollout-python-language?_=1653996853593

        B S 2 Replies Last reply Reply Quote 0
        • B
          balaSP @admin last edited by

          @admin Please explain about two fields AUTH_TOKEN and correlation_id. How to get values for these two fields?

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

            Code isn't finished?

            1 Reply Last reply Reply Quote 0
            • S
              Sukhwant280 @admin last edited by Sukhwant280

              @admin I am not clear what needs to be entered in AUTH_TOKEN and correlation_id. Couldnt find anything on the documentation as well.

              Please help

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

                @admin - found answers to my question on documentation here https://drive.google.com/drive/u/0/folders/1GMwTMfxRdiloUziV4DYwlYchGXbOvTfL

                follow up question : for AUTH_TOKEN, its mentioned (jwt auth token received from Login API). How do we generate auth token login api?

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

                  @admin - is AUTH_TOKEN same as Secret-Key ?

                  Mnagesh 1 Reply Last reply Reply Quote 0
                  • Mnagesh
                    Mnagesh @Sukhwant280 last edited by

                    @Sukhwant280 can you elaborate your Q? with part of code or function and its error or output

                    Now I am full time Algo Trader and successfully developed my own Apps for my personal use.

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      Sukhwant280 @Mnagesh last edited by

                      @Mnagesh - Below is the code form websocket vs 2

                      my question is from where do we get AUTH_TOKEN. I tried adding "Secret-Key" from "Apps & API" section (i.e. this link -> https://smartapi.angelbroking.com/apps) but I get below feeds from websocket.

                      Code
                      from SmartApi.smartWebSocketV2 import SmartWebSocketV2

                      AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzU-w'
                      API_KEY = 'qwert'
                      CLIENT_CODE = 'X123456'
                      FEED_TOKEN = '00998877'

                      correlation_id = "nishant_123_qwerty"
                      action = 1
                      mode = 3

                      Websocket feed:
                      In on pong function==> b'\x00'

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        admin @Sukhwant280 last edited by

                        Hi @Sukhwant280 , Auth_token is JWT token obtained at the time of generating the session using loginbypassword api call.

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          Sukhwant280 @admin last edited by

                          @admin - Thanks. Now I am using below in my code
                          AUTH_TOKEN -> jwtToken from response from generateSession('userid', 'password')
                          FEED_TOKEN -> refreshToken from response from generateSession('userid', 'password')

                          Please confirm if above is not correct, coz still I am getting same response from websockt i.e "Attempting to resubscribe/reconnect...
                          In on pong function==> b'\x00'"

                          I tried to troubleshoot from my end -> it failing at below step (i.e. row no 310 in smartWebsocketV2.py:

                          "token": SmartWebSocketV2._parse_token_value(binary_data[2:27]),

                          Can you help me here to understand whats wrong in my inputs ?

                          A 1 Reply Last reply Reply Quote 1
                          • A
                            admin @Sukhwant280 last edited by

                            Hi @Sukhwant280

                            FeedToken is different from refreshToken

                            jwtToken, refreshToken and feedToken are generated after successful login into your account via SmartAPI.

                            feedToken is required to be passed to a WebSocket connection request to start successful streaming of tick data.

                            Please read more about this in our documentation.

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              Sukhwant280 @admin last edited by

                              @admin
                              I get below response from generateSession. I cant find any relevant for FEED_TOKEN.

                              {"status": True,
                              "message": "SUCCESS",
                              "errorcode": "",
                              "data": {
                              "clientcode": "XXXXXX",
                              "name": "XXXX YYYY",
                              "email": "",
                              "mobileno": "",
                              "exchanges": ["bse_cm", "nse_cm", "nse_fo"],
                              "products": ["BO", "NRML", "CO", "CNC", "MIS", "MARGIN"],
                              "lastlogintime": "",
                              "broker": "",
                              "jwtToken": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                              "refreshToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                              }
                              }

                              Also, are you referring to below doc ? I cant find anything which explains which field to take from api response. Pleas advise
                              https://docs.google.com/document/d/1tZQzU2qNrB98eso6e6yqF3YxvXfK9cn5Xkzw_5jSJL8/edit

                              J 1 Reply Last reply Reply Quote 0
                              • J
                                J88913 @Sukhwant280 last edited by

                                @Sukhwant280 use this code for feedtoken
                                feedToken = obj.getfeedToken()

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