Navigation

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

    Unable to recieve to tick data

    Bugs
    2
    3
    49
    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.
    • T
      tushar last edited by

      Always receiving this -

      Receive stock ticks:: [ { ak: 'nk', task: 'cn', msg: 'cn' } ]
      Receive stock ticks:: [ { ak: 'nk', task: 'mw', msg: 'mw' } ]
      

      I'm using my client_code, password, and Key.

      Below is the code, I've passed my client details (code below doesn't contain my details)

      Code

      let { SmartAPI, WebSocket } = require("smartapi-javascript");
      
      let smart_api = new SmartAPI({
          api_key: "KEY",    // PROVIDE YOUR API KEY HERE
       });
      
      
      smart_api.generateSession("client_code", "PWD")
          .then((data) => {
              // console.log(data)
              return data;
          })
          .then((data) => {
              console.log(data)
              let web_socket = new WebSocket({
                  client_code: "client_code",
                  feed_token: data.feedToken,
                  script: "nse_cm|1594&nse_cm|10738&nse_cm|277&nse_cm|144&nse_cm|685"   //exchange|token for multi stocks use & seperator
              });
      
              web_socket.connect();
              web_socket.on('tick', receiveTick)
      
              function receiveTick(d) {
                  console.log("Receive stock ticks::", d)
              }
          })
          .catch(ex => {
              console.log("EX::", ex)
          });
      
      smart_api.setSessionExpiryHook(customSessionHook);
      
      function customSessionHook() {
          console.log("User loggedout");
      }
      
      T 1 Reply Last reply Reply Quote 0
      • T
        tushar @tushar last edited by

        @admin Please help.

        D 1 Reply Last reply Reply Quote 0
        • D
          Diljeet @tushar last edited by

          @tushar I too faced this issue before, I was not passing proper feedToken, Please verify that feedToken which you are passing is valid.

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