Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. Categories
    3. NodeJS SDK
    Log in to post

    NodeJS SDK

    • N

      How to generate Authorization token for Historical API?
      • nlptechguy  

      4
      0
      Votes
      4
      Posts
      18
      Views

      M

      Hello @nlptechguy , Apologies for the delayed response. Please use the jwt token generated in the response to login API for this purpose.If you have any other issue, please share request and response on smartapi@angelbroking.com. Regards SmartAPI Team
    • D

      Get Ticker List
      nodejs symbol token • • dhwani  

      1
      0
      Votes
      1
      Posts
      14
      Views

      No one has replied

    • G

      Websocket error in nodejs
      • gnani  

      1
      0
      Votes
      1
      Posts
      5
      Views

      No one has replied

    • M

      error in fatching live data using websocket in reactJS
      • mani.upa11  

      5
      1
      Votes
      5
      Posts
      60
      Views

      J

      @mani-upa11 It seems that this is an older way, right now websocketV2 is used.
    • M

      I got binary response from websocket. How to convert from binary to JSON?
      • muthukumardab  

      3
      0
      Votes
      3
      Posts
      31
      Views

      J

      @muthukumardab Try the below code //Working Code which fetches prices of reliance, sbi, and nifty const WebSocket = require('ws'); // WebSocket URL const url = 'ws://smartapisocket.angelone.in/smart-stream'; // Authentication headers const headers = { 'Authorization': 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IlA1Mjk3NzQiLCJyb2xlcyI6MCwidXNlcnR5cGUiOiJVU0VSIiwiaWF0IjoxNjg2NzE2ODYwLCJleHAiOjE2ODY4MDMyNjB9.WmoIdanOGGXox-We42Bre-qSK6yyZQlcci4h3JnLxc8Dt7WgmJZa7IzergbdB2VWPviVg7uKWAi-rOr0H5ijQw', 'x-api-key': 'erZDHFHD', 'x-client-code': 'P529774', 'x-feed-token': 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IlA1Mjk3NzQiLCJpYXQiOjE2ODY3MTY4NjAsImV4cCI6MTY4NjgwMzI2MH0.fWOQ57fcTGqzuVlktvzFYVe7ztZrt8TFIkrLXvX-Z2HqOtR3cSxsDRW9uv8a9YSCKxt348gAmSondkaHmGaBBA' }; // Create a WebSocket instance const socket = new WebSocket(url, { headers }); // Handle WebSocket connection open socket.on('open', () => { console.log('WebSocket connected'); // Send a subscription request const subscriptionRequest = { //correlationID: '', action: 1, params: { mode: 1, tokenList: [ { exchangeType: 1, tokens: ['26000','2885','3045','99926009','99926011'] /* NIFTY-50: 26000 RELIANCE-EQ: 2885 SBIN-EQ: 3045 NIFTY BANK:99926009 NIFTY MIDCAP 100:99926011 SENSEX: 99919000 */ }, /* { exchangeType: 5, tokens: ['234230', '234235', '234219'] }*/ ] } }; socket.send(JSON.stringify(subscriptionRequest)); }); // Handle received messages from the WebSocket socket.on('message', (message) => { // Parse the received binary data based on the provided response contract // Example: Extract the Last Traded Price (LTP) from the received data const data = new Uint8Array(message); const ltpBytes = data.slice(43, 47); const ltpValue = ltpBytes.reduce((value, byte, index) => value + byte * Math.pow(256, index), 0); const ltp = ltpValue / 100; console.log('Received LTP:', ltp); }); // Handle WebSocket connection close socket.on('close', () => { console.log('WebSocket connection closed'); }); // Send heartbeat message every 30 seconds to keep the connection alive setInterval(() => { if (socket.readyState === WebSocket.OPEN) { socket.send('ping'); } }, 30000); P.S. I also had one question which I am not able to find answer to, how to get the price for SENSEX I am not able to find the correct token for it. Please do tell if you know how to get the ltp for sensex.
    • B

      login problem please mygrate me F3877
      • Bittu  

      3
      0
      Votes
      3
      Posts
      36
      Views

      R

      @admin I am setting up the smart api for the first time, I am getting the below response for my code smart_api .generateSession("client-id", "pin", "totp") .then((data) => { console.log(data); return smart_api.getProfile(); }) .then((data) => { console.log(data); // Profile details }) .catch((ex) => { console.log(ex); //Log error }); { status: false, message: 'Invalid totp', errorcode: 'AB1050', data: null } { success: false, message: 'Invalid Token', errorCode: 'AG8001', data: '' }
    • S

      Module not found: Can't resolve 'fs'
      • sonivipul89  

      3
      0
      Votes
      3
      Posts
      17
      Views

      S

      @anand__lunawat no
    • P

      Socket closed CloseEvent {target: WebSocket, type: 'close', wasClean: false, reason: '', code: 1006}
      • prasadmhegde  

      1
      0
      Votes
      1
      Posts
      2
      Views

      No one has replied

    • P

      Websocket error "Error observed : {"isTrusted":true}"
      • pankaj8932  

      1
      0
      Votes
      1
      Posts
      1
      Views

      No one has replied

    • P

      getting "{'message': 'Internal Error', 'errorcode': 'AB2001', 'status': False, 'data': None}" error
      • pravinkale  

      1
      0
      Votes
      1
      Posts
      5
      Views

      No one has replied

    • S

      Getting Error AB1050
      • sauronx  

      6
      0
      Votes
      6
      Posts
      82
      Views

      P

      @pratikpopat92 Thanks
    • R

      is this data provided by the api from the angel one ?
      • ranuj8789  

      1
      0
      Votes
      1
      Posts
      2
      Views

      No one has replied

    • S

      Websocket error ECONNRESET
      • sb302  

      1
      0
      Votes
      1
      Posts
      1
      Views

      No one has replied

    • A

      Websocket not working
      • Ananth  

      1
      0
      Votes
      1
      Posts
      2
      Views

      No one has replied

    • D

      Tick data is not receiving
      websocket • • deepu1829  

      1
      0
      Votes
      1
      Posts
      7
      Views

      No one has replied

    • J

      Login Error
      • jafrinjohn  

      1
      0
      Votes
      1
      Posts
      23
      Views

      No one has replied

    • R

      Websocket is not working
      • rohithmaccs  

      14
      0
      Votes
      14
      Posts
      205
      Views

      A

      @James-Bond please help me i am also getting same response As of written in this post.
    • P

      Error while subscribing for live data feed in websocket in javascript
      • prashant0701_  

      1
      1
      Votes
      1
      Posts
      23
      Views

      No one has replied

    • A

      ID:A861296 PLEASE MIGRATE IT.
      • ankush thorat  

      1
      0
      Votes
      1
      Posts
      4
      Views

      No one has replied

    • N

      Live market feed not receiving
      • nitish.bane  

      2
      0
      Votes
      2
      Posts
      56
      Views

      A

      @nitish-bane it upgraded to websocketV2 check below link https://smartapi.angelbroking.com/topic/1861/user-feedback-websocket-2-0-beta-rollout-python-language/3