Query editor
-- DX Terminal Pro: Cumulative Volume (Hourly)-- Query ID: TBD-- Uses decoded AgentSwapRecorded events for hourly cumulative volume-- Converts ETH volume to USD via prices.usdWITH swap_volume AS (SELECTdate_trunc('hour', s.evt_block_time) AS hour,sum(cast(s.ethAmount AS double) / 1e18) AS eth_volumeFROM dx_terminal_pro_base.Authority_evt_AgentSwapRecorded sWHERE cast(s.ethAmount AS double) > 0GROUP BY 1),eth_prices AS (SELECTdate_trunc('hour', minute) AS hour,avg(price) AS eth_usdFROM prices.usdWHERE blockchain = 'ethereum'AND contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2AND minute >= timestamp '2026-02-24'GROUP BY 1)SELECTsv.hour,sv.eth_volume * ep.eth_usd AS volume_usd,sum(sv.eth_volume * ep.eth_usd) OVER (ORDER BY sv.hour) AS cumulative_volume_usd,sv.eth_volume,sum(sv.eth_volume) OVER (ORDER BY sv.hour) AS cumulative_volume_ethFROM swap_volume svLEFT JOIN eth_prices ep ON sv.hour = ep.hourWHERE ep.eth_usd IS NOT NULLORDER BY sv.hour