Unable to recieve to tick data
-
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"); }
-
@tushar I too faced this issue before, I was not passing proper feedToken, Please verify that feedToken which you are passing is valid.
-
@admin Please help.