Query editor
-- DUNE Query to fetch Total Gas Paid on DEX daily in the past week--> Reflects the overall volume and activity on decentralized exchanges.--> Helps traders gauge liquidity and activity levels, which can impact their trading strategies.-- Start the SELECT statementSELECT-- Truncate the block_time to day to group transactions occurring on the same dayDATE_TRUNC('day', ethereum.transactions.block_time) AS day,-- Calculate the total gas paid, convert gas_price from wei to ETH, and round to 2 decimalsROUND(SUM(ethereum.transactions.gas_used * (ethereum.transactions.gas_price / 1e18)),2) AS gas_paid-- Begin joining datasetsFROM dex.trades-- Perform a LEFT JOIN to combine data from dex.trades and ethereum.transactions based on transaction hashesLEFT JOIN ethereum.transactionsON dex.trades.tx_hash = ethereum.transactions.hash-- Filter the results to only include transactions from the last 7 daysWHEREethereum.transactions.block_time >= NOW() - INTERVAL '7' DAY-- Group the results by the truncated block_time to aggregate data on a daily basisGROUP BYDATE_TRUNC('day', ethereum.transactions.block_time)-- Order the grouped results by day in descending order ot have recent data firstORDER BYday DESC