Query editor
WITH pair_volume AS (SELECT'Bitget Wallet' AS wallet,blockchain,COALESCE(token_pair, 'UNKNOWN') AS token_pair,COUNT(*) AS trade_rows,COUNT(DISTINCT tx_hash) AS tx_count,SUM(amount_usd) AS volume_usdFROM dex_aggregator.tradesWHERE project = 'bitget_dex_aggregator'AND block_time >= CURRENT_TIMESTAMP - INTERVAL '7' DAYAND block_month >= DATE_TRUNC('month', CURRENT_TIMESTAMP - INTERVAL '7' DAY)AND amount_usd IS NOT NULLGROUP BY 1, 2, 3),ranked AS (SELECTwallet,blockchain,token_pair,trade_rows,tx_count,volume_usd,SUM(volume_usd) OVER (PARTITION BY blockchain) AS chain_volume_usdFROM pair_volume)SELECTwallet,blockchain,token_pair,trade_rows,tx_count,volume_usd,chain_volume_usd,volume_usd / NULLIF(chain_volume_usd, 0) AS pair_chain_volume_pctFROM rankedORDER BY volume_usd DESCLIMIT 250