Navigation

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

    Token List downLoad

    Python SDK
    4
    35
    273
    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.
    • H
      Heena Shah @admin last edited by Heena Shah

      from smartapi import SmartConnect
      from smartapi import WebSocket

      obj=SmartConnect(api_key="")
      data = obj.generateSession("","")
      feedToken=obj.getfeedToken()

      WebSocket

      token="nse_cm|2885"
      ss = WebSocket(feedToken,"")

      def on_tick(ws, tick):
      print(tick)

      def on_connect(ws, response):
      ws.send_request(token)

      def on_close(ws, code, reason):
      ws.stop()

      Assign the callbacks.

      ss.on_ticks = on_tick
      ss.on_connect = on_connect
      ss.on_close = on_close

      ss.connect()

      H 1 Reply Last reply Reply Quote 0
      • H
        Heena Shah @Heena Shah last edited by

        <function on_connect at 0x000001716110FEE0>

        getting above error

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

          HI @Heena-Shah Please do not share your private credential publicly here.

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

            hi @Heena-Shah we will update the web socket code soon.

            H 1 Reply Last reply Reply Quote 0
            • H
              Heena Shah @admin last edited by

              @admin when will b new updated websocket code available

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

                Hi @Heena-Shah we will update the code in this code.we will update you once we do that.

                H 1 Reply Last reply Reply Quote 0
                • H
                  Heena Shah @admin last edited by Heena Shah

                  @admin
                  token="nse_cm|2885"
                  task="sfi" # mw|sfi|dp

                  obj=SmartConnect(api_key=api_key)
                  login = obj.generateSession(client_code,your_password)
                  #refreshToken= login['data']['refreshToken']
                  feedToken=obj.getfeedToken()

                  #userProfile= obj.getProfile(refreshToken)
                  ss = WebSocket(feedToken,client_code)

                  def on_tick(ws, tick):
                  print("Ticks: {}".format(tick))

                  def on_connect(ws, response):
                  ws.websocket_connection()
                  ws.send_request(token,task)

                  def on_close(ws, code, reason):
                  ws.stop()

                  Assign the callbacks.

                  ss.on_ticks = on_tick
                  ss.on_connect = on_connect
                  ss.on_close = on_close

                  p1 = multiprocessing.Process(target = ss.connect())
                  sys.exit()
                  p1.start()

                  Getting only...
                  <function on_connect at 0x00000227435DFEE0>
                  Ticks: [{'ak': 'nk', 'msg': 'sfi', 'task': 'sfi'}]

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

                    Hi @Heena-Shah which version of sdk you are using.

                    H 2 Replies Last reply Reply Quote 0
                    • H
                      Heena Shah @admin last edited by

                      @admin
                      python 3.8.3

                      H 1 Reply Last reply Reply Quote 0
                      • H
                        Heena Shah @Heena Shah last edited by

                        @Heena-Shah

                        smartapi-python
                        version
                        1.2.6

                        1 Reply Last reply Reply Quote 0
                        • H
                          Heena Shah @admin last edited by

                          @admin
                          Login error

                          {'status': False, 'message': 'Login Id or password is invalid', 'errorcode': 'AB1007', 'data': None}

                          H 1 Reply Last reply Reply Quote 0
                          • H
                            Heena Shah @Heena Shah last edited by

                            @admin

                            Do I need to register for market feed??

                            Do I need to refresh api_key and password every day??

                            S A 2 Replies Last reply Reply Quote 0
                            • S
                              shrikantshet @Heena Shah last edited by shrikantshet

                              @Heena-Shah
                              Firstly, there's a possibility that you data hasn't been migrated. Communicate issue here, and the Angel team will let you know if you can access APIs with the account you are using. You only need to tell them the client code. I am not sure if they've completed migration.

                              Secondly, try using the APIs instead of library Angel has provided. I had issues using the library, but, could use APIs smoothly.

                              You don't need sign up for SmartAPI to get market feed. It is free. It is just that you need to sign up. You don't need to refresh API key and password. However, you need to get a new jwttoken every day. It is with this token that you can use the APIs.

                              H 1 Reply Last reply Reply Quote 0
                              • H
                                Heena Shah @shrikantshet last edited by

                                @shrikantshet
                                My account is new account created online not attached to any sub-brokers. Please check client code H104220

                                Presently I am using Only Market feed app.
                                Order is still under development.
                                Do I still have to migrate my account?

                                Once after migration , I can use web based desktop application
                                also at same time?

                                H 1 Reply Last reply Reply Quote 0
                                • H
                                  Heena Shah @Heena Shah last edited by

                                  @shrikantshet

                                  Is my version of python & SmartAPI both ok??

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

                                    Hi @Heena-Shah yes we need it also please go through the documentation https://smartapi.angelbroking.com/docs

                                    H 1 Reply Last reply Reply Quote 0
                                    • H
                                      Heena Shah @admin last edited by

                                      @admin
                                      My account is new account created online not attached to any sub-brokers.
                                      Please check client code H104220 and migrate

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

                                        hi @Heena-Shah said in Token List downLoad:

                                        My account is new account created online not attached to any sub-brokers.
                                        Please check client code H104220 and migrate

                                        your account is migrated.

                                        H 1 Reply Last reply Reply Quote 0
                                        • H
                                          Heena Shah @admin last edited by

                                          @admin
                                          generateSession error

                                          {'status': False, 'message': 'Login Id or password is invalid', 'errorcode': 'AB1007', 'data': None}

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

                                            Hi @Heena-Shah Reset your password and try again.

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