1 minute to read - Apr 12, 2023

Query DEX on Dune with Spark SQL language

I want to query dex.trades table on DuneAnalytics V2. Find the last 24 hours' volume traded on the Ethereum blockchain

To find the volume of Ethereum trades on the dex.trades table in the last 24 hours on DuneAnalytics V2, you can use the following query:

Copy code

`SELECT SUM(volume) FROM dex.trades WHERE block_timestamp >= current_timestamp - interval '1 day' AND base_asset_symbol = 'ETH'`

This query selects the sum of the `volume` column from the `dex.trades` table, filtered to only include rows where the `block_timestamp` is within the past 24 hours (using the `current_timestamp - interval '1 day'` expression) and the `base_asset_symbol` is 'ETH'. This will give you the total volume of Ethereum trades in the specified time period.

I hope this helps! Let me know if you have any questions.

loading...