SignificantTrades icon indicating copy to clipboard operation
SignificantTrades copied to clipboard

Minor question

Open kuldeeps48 opened this issue 4 years ago • 1 comments

Screenshot_2020-04-24-12-14-23-10_3aea4af51f236e4932235fdada7d1643 Hi, As we can see, there's a transaction with 1000k value. I thought these would show up as 1 million and with cash animation? Correct me if I misunderstood.

Thanks

kuldeeps48 avatar Apr 24 '20 06:04 kuldeeps48

You are right, definitely an issue here Most likely a rounding error, but since I dont do any round myself, maybe its a limitation of javascript related to the number of decimal allowed

https://pastebin.com/LrPiyiV0 < theses are the trades that was in this aggregation respectively exchange | timestamp | price | size | side

So if you take thoses trades, sum the size and prices

var trades = rawPastbinOutput.split('\n').map(a => a.split(' '));
var size = trades.reduce((sum, trade) => sum + (+trade[3]), 0)
var price = trades.reduce((sum, trade) => sum + (trade[2] * trade[3]), 0) / size

You get (size * price) = 132.8170523018985 * 7529.153694263291 = 999999.9999999999

Imma investigate this but one solution could be to round the very last decimal Math.ceil(999999.9999999999 * 1000000000) / 1000000000 = 100000

Tucsky avatar Apr 24 '20 07:04 Tucsky