Query editor
SELECTdate_trunc('MONTH', block_date) AS trading_month,COUNT(DISTINCT tx_id) AS monthly_dolphin_trades,COUNT(DISTINCT trader_id) AS unique_monthly_traders,SUM(amount_usd) AS total_monthly_volume_usd,AVG(amount_usd) AS avg_monthly_trade_size,-- Growth metrics (month-over-month)LAG(COUNT(DISTINCT tx_id)) OVER (ORDER BY date_trunc('MONTH', block_date)) AS prev_month_trades,LAG(SUM(amount_usd)) OVER (ORDER BY date_trunc('MONTH', block_date)) AS prev_month_volume,-- Calculate month-over-month growthCASEWHEN LAG(COUNT(DISTINCT tx_id)) OVER (ORDER BY date_trunc('MONTH', block_date)) > 0THEN ((COUNT(DISTINCT tx_id) - LAG(COUNT(DISTINCT tx_id)) OVER (ORDER BY date_trunc('MONTH', block_date))) * 100.0 / LAG(COUNT(DISTINCT tx_id)) OVER (ORDER BY date_trunc('MONTH', block_date)))ELSE NULLEND AS trade_count_growth_pct,CASEWHEN LAG(SUM(amount_usd)) OVER (ORDER BY date_trunc('MONTH', block_date)) > 0THEN ((SUM(amount_usd) - LAG(SUM(amount_usd)) OVER (ORDER BY date_trunc('MONTH', block_date))) * 100.0 / LAG(SUM(amount_usd)) OVER (ORDER BY date_trunc('MONTH', block_date)))ELSE NULLEND AS volume_growth_pct,-- Platform diversityCOUNT(DISTINCT project) AS dex_platforms_count,-- Token diversityCOUNT(DISTINCT CONCAT(token_bought_symbol, '-', token_sold_symbol)) AS unique_trading_pairs,-- Trading intensity metricsCOUNT(DISTINCT tx_id) / COUNT(DISTINCT trader_id) AS avg_trades_per_trader,SUM(amount_usd) / COUNT(DISTINCT trader_id) AS avg_volume_per_trader,-- Fee analysisSUM(fee_usd) AS total_monthly_fees,AVG(fee_usd) AS avg_fee_per_trade,SUM(fee_usd) / SUM(amount_usd) * 100 AS avg_fee_percentageFROM dex_solana.tradesWHERE amount_usd BETWEEN 10000 AND 99999AND block_date >= CURRENT_DATE - INTERVAL '365' DAYAND amount_usd IS NOT NULLGROUP BY 1ORDER BY trading_month DESC;