Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. perceptron
    P
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    perceptron

    @perceptron

    3
    Reputation
    10
    Posts
    2
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    perceptron Follow

    Best posts made by perceptron

    • Web Socket Issues

      @Moderator_1 I am using smart api for creating a live data feed for stock prices on my site. I am using live websocket streaming service. But issue is in javascript sdk prices of almost 400-500 stocks are received 0. I also tried quote mode but still no success. Can you tell me what could be the issue?

      const getConnection = async () => {
            db = await spp.find({});
            var array = db.map(obj => obj.token);
            var bbb = array.slice(1000,);
            const rtg = await aaaa();
            abc(bbb, rtg);
        };
        
      module.exports = getConnection;
      
      function abc(array, data) {
        const web_socket = new WebSocketV2({
          jwttoken: data.jwtToken,
          apikey: 'API_KEY',
          clientcode: "CLIENT_CODE",
          feedtype: data.feedToken,
        });
      
        web_socket.connect().then((res) => {
          let json_req = {
            "correlationID": "abcde12345",
            "action": 1,
            "mode": 2,
            "exchangeType": 1,
            "tokens": array
          };
      
          web_socket.fetchData(json_req);
          web_socket.on('tick', receiveTick);
          var x = 0;
          async function receiveTick(data) {
            if (data.token !== undefined) {
              
              const io = getIO();
              const tokenWithQuotes = data.token;
              const tokenWithoutQuotes = tokenWithQuotes.replace(/['"]+/g, '');
              
              const price = parseInt(data.last_traded_price, 10) / 100;
              // console.log(tokent_to_stock[tokenWithoutQuotes],price);
              if(price == 0) {
                x++;
                console.log(tokent_to_stock[tokenWithoutQuotes], x);
              }
                io.to(tokent_to_stock[tokenWithoutQuotes]).emit('update', {
                  stock: tokent_to_stock[tokenWithoutQuotes],
                  price: price
                });
      
                await spp.updateOne(
                  { token: tokenWithoutQuotes },
                  [{
                    $set: {
                      previousprice: "$currentprice",
                      currentprice: price
                    }
                  }]
                );
            }
          }
        });
      }
      

      this is my code.

      posted in Bugs
      P
      perceptron
    • RE: Not getting connected to Websocket2.0

      @Moderator_2 I am still getting the same error anyway. I have just initiated one socket.

      posted in General Discussion
      P
      perceptron

    Latest posts made by perceptron

    • RE: Not getting connected to Websocket2.0

      @Moderator_2 I am still getting the same error anyway. I have just initiated one socket.

      posted in General Discussion
      P
      perceptron
    • RE: Web Socket Issues

      @robin they are not giving any updates why so? i have asked them so many times.

      posted in Bugs
      P
      perceptron
    • RE: Web Socket Issues

      @Moderator_2 @Moderator_1 Is there any update please i need this.

      posted in Bugs
      P
      perceptron
    • RE: Web Socket Issues

      @perceptron @Moderator_1 @Moderator_2 is there any update?

      posted in Bugs
      P
      perceptron
    • RE: Web Socket Issues

      @Moderator_2 @Moderator_1 is there any progress on this issue?

      posted in Bugs
      P
      perceptron
    • RE: Wrong LTP data

      @bansal3amardeep you have to divide it by 100. This is the general case for all.

      posted in General Discussion
      P
      perceptron
    • RE: Web Socket Issues

      @Moderator_2 I am initiating 2 sockets basically with first socket having 0 to 1000 NSE stocks and other having the rest. I do not think that should be much of an issue because even when i am initiating request with only one socket and one stock this error persists.

      posted in Bugs
      P
      perceptron
    • Web Socket Issues

      @Moderator_1 I am using smart api for creating a live data feed for stock prices on my site. I am using live websocket streaming service. But issue is in javascript sdk prices of almost 400-500 stocks are received 0. I also tried quote mode but still no success. Can you tell me what could be the issue?

      const getConnection = async () => {
            db = await spp.find({});
            var array = db.map(obj => obj.token);
            var bbb = array.slice(1000,);
            const rtg = await aaaa();
            abc(bbb, rtg);
        };
        
      module.exports = getConnection;
      
      function abc(array, data) {
        const web_socket = new WebSocketV2({
          jwttoken: data.jwtToken,
          apikey: 'API_KEY',
          clientcode: "CLIENT_CODE",
          feedtype: data.feedToken,
        });
      
        web_socket.connect().then((res) => {
          let json_req = {
            "correlationID": "abcde12345",
            "action": 1,
            "mode": 2,
            "exchangeType": 1,
            "tokens": array
          };
      
          web_socket.fetchData(json_req);
          web_socket.on('tick', receiveTick);
          var x = 0;
          async function receiveTick(data) {
            if (data.token !== undefined) {
              
              const io = getIO();
              const tokenWithQuotes = data.token;
              const tokenWithoutQuotes = tokenWithQuotes.replace(/['"]+/g, '');
              
              const price = parseInt(data.last_traded_price, 10) / 100;
              // console.log(tokent_to_stock[tokenWithoutQuotes],price);
              if(price == 0) {
                x++;
                console.log(tokent_to_stock[tokenWithoutQuotes], x);
              }
                io.to(tokent_to_stock[tokenWithoutQuotes]).emit('update', {
                  stock: tokent_to_stock[tokenWithoutQuotes],
                  price: price
                });
      
                await spp.updateOne(
                  { token: tokenWithoutQuotes },
                  [{
                    $set: {
                      previousprice: "$currentprice",
                      currentprice: price
                    }
                  }]
                );
            }
          }
        });
      }
      

      this is my code.

      posted in Bugs
      P
      perceptron
    • RE: Changes in API Rate Limit

      @Moderator_1 is there any new limit on live socket data streaming?

      posted in General Discussion
      P
      perceptron
    • Adjusted close price of stocks

      Dear @admin,
      Can you please help me get the adjusted price data using historical API? I am trying to fetch the historical data of stocks using historical API but I am receiving non-adjusted data. Can you tell me how I can get the adjusted close price?

      posted in General Discussion
      P
      perceptron