Skip to content

Commit fca70ec

Browse files
committedMar 18, 2018
fix ether calculation - add decimals
1 parent 0e883ef commit fca70ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎statistics/tradesPerDay.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async function processEvents(events){
7676
uniqueToday = {};
7777
console.log("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t\t%s",
7878
day, numTradesToday, numSmallTrades, uniqueAddressToday, newAddressToday,
79-
numEthersToday, (numEthersToday / numTradesToday).toFixed(2), firstBlockToday,
79+
numEthersToday.toFixed(2), (numEthersToday / numTradesToday).toFixed(2), firstBlockToday,
8080
await dateTimeFromBlock(firstBlockToday));
8181

8282
firstBlockToday = endDayBlock;
@@ -105,7 +105,8 @@ async function processEvents(events){
105105
wei = web3.utils.toBN(event.actualDestAmount);
106106
}
107107

108-
let ethers = wei.div(web3.utils.toBN(10).pow(web3.utils.toBN(18)));
108+
let ethers = wei.div(web3.utils.toBN(10).pow(web3.utils.toBN(15)));
109+
ethers = ethers / 1000;
109110

110111
numEthersToday += 1 * ethers.valueOf();
111112

0 commit comments

Comments
 (0)
Please sign in to comment.