-- forked from mighty_joe / Trading Volume, Number of Transactions and Active Users across Uniswap-v3, Curve, Sushiswap, & Balancer (between 01/12/2023 and 05/01/2024) @ https://flipsidecrypto.xyz/mighty_joe/q/984rAzwcVJnD/trading-volume-number-of-transactions-and-active-users-across-uniswap-v3-curve-sushiswap-balancer-between-01-12-2023-and-05-01-2024
SELECT
date_trunc(day, block_timestamp) DATE,
sum( amount_in_usd) AS Trading_volume,
COUNT(DISTINCT tx_hash) AS Number_of_transactions,
COUNT(DISTINCT origin_from_address) AS Active_users,
platform
FROM ethereum.defi.ez_dex_swaps
WHERE platform IN ('uniswap-v3', 'curve', 'sushiswap','balancer')
AND amount_in_usd IS NOT NULL
AND block_timestamp :: date BETWEEN '2023-12-01' AND '2024-01-05'
GROUP BY 1,5
ORDER BY 1 ASC