Navigation

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

    How to get live price data?

    Python SDK
    5
    12
    275
    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
      smartarman @smartarman last edited by

      @smartarman IN PYTHON

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

        @smartarman

        There is a sample code in GitHub

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

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

          @rajanprabu in that sample code i am not able to understand where to put the scrip name to get the data

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

            @smartarman

            token="nse_cm|2885&nse_cm|1594&nse_cm|11536"

            is what you need.

            U S 2 Replies Last reply Reply Quote 0
            • U
              user01 @Surya 1 last edited by user01

              Hi @rajanprabu

              The code mentioned at:
              https://github.com/angelbroking-github/smartapi-python

              Does contain two parts:
              Part 1:
              Ordering through API

              Part 2:
              Ordering through Websockets

              am I correct?

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

                @rajanprabu is the feed token = scret key and client id = API key

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

                  @smartarman

                  client id id what you use in your normal login to trade.angelbroking.com. API key is what you get from the https://smartapi.angelbroking.com. There is no use of secret key in this process yet. So you can ignore them for time being.

                  You need to generate feed token like how its given in the GitHub page and use it for web sockets.

                  1 Reply Last reply Reply Quote 0
                  • S
                    smartarman last edited by

                    now i am getting this output where is the price:-
                    Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:19'}]
                    Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:20'}]
                    Ticks: [{'name': 'tm', 'tvalue': '20/01/2021 19:40:21'}]

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jiwan1986 @smartarman last edited by

                      @smartarman Here's the code

                      CLIENT_ID = 'CLIENT_ID'
                      obj = SmartConnect(api_key="API_KEY")
                      data = obj.generateSession(CLIENT_ID, "PASSWORD")
                      refreshToken = data['data']['refreshToken']
                      
                      
                      FEED_TOKEN = obj.getfeedToken()
                      token = 'cde_fo|1814'
                      
                      ss = WebSocket(FEED_TOKEN, CLIENT_ID)
                      
                      def on_tick(ws, ticks):
                      	print(ticks)
                      	
                      def on_connect(ws, response):
                      	print("on connect")
                      	ws.send_request(token)
                      
                      def on_close(ws, code, reason):
                      	print("on close")
                      	ws.stop()
                      
                      ss.on_ticks = on_tick
                      ss.on_connect = on_connect
                      ss.on_close = on_close
                      
                      ss.connect()
                      
                      R 1 Reply Last reply Reply Quote 0
                      • R
                        rahul4019 @jiwan1986 last edited by

                        @rjbanna could you please tell me what are the various categories of the feed possible.
                        nse_cm -> cash market
                        what are the classifications for future markets and commodities/?

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

                          @PandaTrade

                          Have a looks the document..

                          https://smartapi.angelbroking.com/docs/WebSocket

                          You can get your token for instruments here

                          https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json

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