0

i have this code, and the Rows are retrieving the data as: 4.3999999999999997e-7 i need to rounddown the numbers to 8 decimals so they will display properly..

i tried this:

utils.roundDown(rows[i].fromBuyerToSeller/rows[i].fromSellerToBuyer*1).toFixed(8)

and it works properly numbers are displayed as expected in the API but the chart is not retrieving the data, my question is why the chart is not retrieving the data?

This is the original code:

if (rows[i - 1].fromBuyerToSeller/rows[i - 1].fromSellerToBuyer > rows[i - 1].price) {
                    const data = ([
                        rows[i].time*1,//time.toUTCString(),
                        rows[i].fromBuyerToSeller/rows[i].fromSellerToBuyer*1,
                        rows[i - 1].fromBuyerToSeller/rows[i - 1].fromSellerToBuyer*1,
                        rows[i - 1].price*1,
                        rows[i - 1].fromBuyerToSeller/rows[i - 1].fromSellerToBuyer*1,
            rows[i - 1].fromSellerToBuyer.toFixed(8)
                    ]);
                    retData.push(data);





Chart.html
// split the data set into trading and volume
  var trading = [],
      volume = [],
      dataLength = data.length,
      // set the allowed units for data grouping
      groupingUnits = [[
          'hour',                         // unit name
          [1]                             // allowed multiples
      ], [
          'day',
          [1, 7]
      ]],

      i = 0;

  for (i; i < dataLength; i += 1) {
      trading.push([
          data[i][0], // the date  
          data[i][1], // open
          data[i][2], // high
          data[i][3], // low
          data[i][4] // close
      ]);

      volume.push([
          data[i][0], // the date
          data[i][5] // the volume
      ]);
  }```
Samuel Philipp
  • 10,631
  • 12
  • 36
  • 56

0 Answers0