Query editor
--GOAL: Find DEXs projects on ETH and compare them based on number of trades on each, total volume in usd of trades, average trade volume in USD, number of token pairs traded for the past one year.WITH dex_metrics AS (SELECTproject,COUNT(*) AS num_trades,SUM(amount_usd) AS total_volume_usd,AVG(amount_usd) AS avg_trade_volume_usd,COUNT(DISTINCT token_pair) AS num_token_pairsFROM dex.tradesWHERE block_time >= CURRENT_DATE - INTERVAL '365' DAYAND blockchain = 'ethereum'GROUP BY project)SELECT --final selectproject,num_trades,total_volume_usd,avg_trade_volume_usd,num_token_pairsFROM dex_metricsORDER BY total_volume_usd DESC --this gives the total volume in dollar a project has made in the last one yearLIMIT 10 --that means give me the top 10 dexes on the eth network