24H trade volume

Let's build a text chart to show the trading volume of past 24 hours.

1.Choose Transaction data source.

2. Use Filter instruction.

Search all the transactions which contain SellBaseToken(seller, payBase, receiveQuote) or BuyBaseToken(buyer, receiveBase, payQuote) logs. And to be completely accurate, you also want to limit the logs.address to all the trading pairs on DODO.

It's relative safe not to include the logs.address as part of the filter since the chance that other protocols might use the exact same log name and parameters is relative small at this stage. The chart would also require no update when DODO adds new trading pair.

3. Using Project instruction to filter out logs which are not SellBaseToken or BuyBaseToken.

What data looks like now:

4. Use Project to sum up all the trade volume in one transaction

The trade volume is in the third parameter of BuyBaseToken log, payQuote It can be referred as $$this.params.2.value

5. Don't forget to divide it by 1000000 since USDT and USDC are both 6 decimals.

What the data looks like now:

6. Use Group to sum up the value from all the transactions (in the past 24 hours).

7. Plug it in and you are all set!

Last updated