Query editor
SELECTCOUNT(*) AS total_trades,SUM(CAST(r.surplus_fee AS double) / 1e18) AS total_surplus_fee_eth,SUM(t.amount_usd) AS total_volume_usdFROM dex.trades tJOIN cow_protocol_ethereum.order_rewards rON t.tx_hash = r.tx_hashWHERE t.blockchain = 'ethereum'AND t.project = 'cow_protocol'AND t.block_time >= NOW() - INTERVAL '3' HOURBut surplus_fee is in sell-token atoms (not always ETH). A more accurate approach uses dex.trades to get the sell token and price. Simpler version using the trade_slippage table whichalready has USD:SELECTCOUNT(*) AS total_trades,SUM(ts.amount_usd) AS total_slippage_usd,SUM(ts.trade_usd_value) AS total_volume_usdFROM cow_protocol_ethereum.trade_slippage tsWHERE ts.block_time >= NOW() - INTERVAL '3' HOUR