Navigation

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

    get quotes index in sensex

    Bugs
    3
    18
    126
    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.
    • A
      admin @swarup last edited by admin

      HI @swarup You can subscribe to those token which are available in json file.

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

        @admin I find only nifty 50 and nifty bank. where are rest. Are they in another name.
        I have used Nodejs SDK to subscribe websocket. I used filter method to filter out token. Here is my code :-

        function search(symbol){
        let fs=require('fs');
        let script=fs.readFileSync('path to the file');
        let decoded_script=JSON.parse(script,''utf8);
        let filter=decoded_script.filter(i => i.symbol===symbol);
        console.log(filter);
        }
        search('SENSEX');
        //It returns 
        [{}];
        //Where If I search nifty  It returns
        [ { token: '26000', symbol: 'NIFTY', name: 'NIFTY',  expiry: '', strike: '-1.000000', lotsize: '-1', instrumenttype: '', exch_seg: 'NSE',tick_size: '-1.000000' } ]
        

        Is it wrong? Help me...........

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

          HI @swarup You want to subscribe to other tokens correct..?

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

            Hi @swarup post your websocket code here.

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

              @admin

              let socket={};
              
              soket.index=function (userid,feedtoken){
              let { SmartAPI, WebSocket } = require("smartapi-javascript");
              let web_socket = new WebSocket({
                  client_code: userid,   
                  feed_token: feedtoken
              });
              web_socket.connect()
                  .then(() => {
                      web_socket.runScript("nse_cm|26000&nse_cm|26009", "mw") 
              
                      setTimeout(function () {
                          web_socket.close()
                      }, 3000)
                  })
              
              web_socket.on('tick', receiveTick);
              function receiveTick(data) {
                  console.log("receiveTick:::::", data)
              }
              } 
              //Now I am calling the function
              socket.index('my userid','feed token I get from login');
              
              1 Reply Last reply Reply Quote 0
              • S
                swarup @admin last edited by

                @admin Yes. How can I do that....

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

                  Hi @swarup You have not passed other tokens in websocket code.

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

                    @admin I don't know what the tokens are. Please share the tokens for the indices

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

                      @swarup I have another question also. As per the documentation I have to pass 'sfi' for index feed but when I pass 'sfi' task. I am unable to get values. As per my code, After 3 sec I get a message in console, 'socket closed'. I tried my many times but in vain

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

                        @swarup Hi, Some update I want to give. I again downloaded the script.json file.
                        From https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json
                        Then converted to csv file.
                        After opening it in Excel I found some tokens which are,

                        [ {"NIFTY IT" : "26008"},{"NIFTY 100": "26012"},{"NIFTY MIDCAP 50": "26014"}]
                        

                        I search a lot but can't find the correct tokens.
                        Intersecting thing is that nifty it and nifty 100 have symbols with CNXIT and CNX100 which is similar to yahoo finance symbol. But what about the other symbols. Mainly SENSEX.
                        Thank you in advance.

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

                          @swarup said in get quotes index in sensex:

                          Hi, Some update I want to give. I again downloaded the script.json file.
                          From https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json
                          Then converted to csv file.
                          After opening it in Excel I found some tokens which are,
                          [ {"NIFTY IT" : "26008"},{"NIFTY 100": "26012"},{"NIFTY MIDCAP 50": "26014"}]

                          I search a lot but can't find the correct tokens.
                          Intersecting thing is that nifty it and nifty 100 have symbols with CNXIT and CNX100 which is similar to yahoo finance symbol. But what about the other symbols. Mainly SENSEX.
                          Thank you in advance.
                          Currently we provide only those symbol data which are listed in instrument dump file.

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

                            @admin Can you tell me what is the token for sensex and india vix.

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

                              Hi @swarup You need to iterate through the dump file.

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

                                @admin I cannot find the symbols.

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

                                  @swarup Can you give me hint to find the tokens.

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

                                    @swarup Hi ..have you got the sensex symbol or token related information?

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

                                      HI @Sourav @swarup Pass task as "sfi" and token as "SENSEX" .

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