Query editor
-- ETH/USD hourly. Prefers the Fables ETH/USDG pool's own swaps, and falls back to Dune's curated-- WETH series for the hours before that pool existed. Without the fallback every PROLOGUE swap from-- 17 to 19 August is dropped, which is more than half of them.WITH eth_ref AS (SELECT date_trunc('hour', timestamp) AS h, avg(price) AS eth_usdFROM prices.hourWHERE blockchain = 'ethereum'AND contract_address = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2AND timestamp >= TIMESTAMP '2026-08-14'GROUP BY 1),eth_pool AS (SELECT date_trunc('hour', evt_block_time) AS h,avg(abs(CAST(amount1 AS double))/1e6 / NULLIF(abs(CAST(amount0 AS double))/1e18, 0)) AS eth_usdFROM uniswap_v4_robinhood.poolmanager_evt_swapWHERE id = 0xbac3aa3b91584a53a579b3c999a56756e954e59247e497bad1d25a4334bde551AND amount0 <> 0 AND amount1 <> 0GROUP BY 1),eth_px AS (SELECT r.h, COALESCE(p.eth_usd, r.eth_usd) AS eth_usdFROM eth_ref r LEFT JOIN eth_pool p ON p.h = r.h),pro AS (SELECT evt_block_time,abs(CAST(amount0 AS double))/1e18 AS eth_amt,abs(CAST(amount1 AS double))/1e18 AS pro_amtFROM uniswap_v4_robinhood.poolmanager_evt_swapWHERE id = 0x8651e656738064177752a395dbde2b2a9e3fc469edc2a9212e6060c0990bb7ebAND amount0 <> 0 AND amount1 <> 0),daily AS (SELECT date_trunc('day', p.evt_block_time) AS day,sum(p.eth_amt * e.eth_usd) AS volume_usd,avg(p.eth_amt * e.eth_usd / NULLIF(p.pro_amt, 0)) AS price_usd,count(*) AS swapsFROM pro p JOIN eth_px e ON e.h = date_trunc('hour', p.evt_block_time)GROUP BY 1),fees AS (SELECT date_trunc('day', l.block_time) AS day,sum(CAST(bytearray_to_uint256(bytearray_substring(l.data, 1, 32)) AS double)/1e18 * e.eth_usd) AS creator_fee_usdFROM robinhood.logs lJOIN eth_px e ON e.h = date_trunc('hour', l.block_time)WHERE l.contract_address = 0xd35e9ca72f64c7f93be30fad67524323396b36d7AND l.topic0 = 0xa13569eccad8e9d7eed1a66b1944fe2a6ff946072c636c0a8c5af0ac6c24be5bAND bytearray_substring(l.data, 97, 32) = 0x000000000000000000000000b9972ca7188e511174947e3936a5315ac7073277GROUP BY 1)SELECT d.day,d.price_usd,d.volume_usd,d.swaps,COALESCE(f.creator_fee_usd, 0) AS creator_fee_usd,sum(COALESCE(f.creator_fee_usd, 0)) OVER (ORDER BY d.day) AS creator_fee_total_usdFROM daily dLEFT JOIN fees f ON f.day = d.dayORDER BY d.day