Query editor
-- Aggregate the total USD trading volume for each token in the last 3 months.-- SELECT-- project_contract_address,-- block_time,-- token_bought_symbol AS token_1,-- token_sold_symbol AS token_2,-- AVG(amount_usd) AS avg_amount,-- SUM(amount_usd) AS total_trading_volume-- FROM dex.trades-- WHERE-- block_time >= date_trunc('day', now()) - INTERVAL '3' month-- AND amount_usd IS NOT NULL-- GROUP BY-- block_time,-- project_contract_address,-- token_bought_symbol,-- token_sold_symbol-- ORDER BY-- total_trading_volume DESC-- LIMIT 10;-- Determine the day with the highest trading volume for each token.WITH daily_volumes AS (SELECTDATE(block_time) AS trade_day,token_bought_symbol AS token,SUM(amount_usd) AS total_trading_volumeFROM dex.tradesWHERE amount_usd IS NOT NULLGROUP BY DATE(block_time), token_bought_symbol),ranked_volumes AS (SELECTtrade_day,token,total_trading_volume,RANK() OVER (PARTITION BY token ORDER BY total_trading_volume DESC) AS volume_rankFROM daily_volumes)SELECTtrade_day,token,total_trading_volumeFROM ranked_volumesWHERE volume_rank = 1ORDER BY total_trading_volume DESCLIMIT 100;