Query editor
withweth_prices as (selectminute,pricefrom prices.usdwhere blockchain = 'base'and contract_address = 0x4200000000000000000000000000000000000006and minute between cast('2025-10-10 20:00' as timestamp) and cast('2025-10-10 23:00' as timestamp)),oracle_prices as (selectfrom_unixtime(timestamp) as datetime,oracle_price,'SUI' as assetfrom dune.index_coop.dataset_sui_oracle_historical_prices_minutewhere from_unixtime(timestamp) >= timestamp '2025-10-10 20:00'and from_unixtime(timestamp) <= timestamp '2025-10-10 23:00'union allselectfrom_unixtime(timestamp) as datetime,oracle_price,'XRP' as assetfrom dune.index_coop.dataset_xrp_oracle_historical_prices_minutewhere from_unixtime(timestamp) >= timestamp '2025-10-10 20:00'and from_unixtime(timestamp) <= timestamp '2025-10-10 23:00'),aerodrome_swaps as (selectdate_trunc('minute', evt_block_time) as minute,case contract_addresswhen 0x5c45b0f48c326f79b56709d8f63ce2bee7697106then power(cast(sqrtPriceX96 as double) / power(2, 96), 2)when 0x61C6e9E93592e535Efc1BEE07f491A517e98f6d0then 1.0 / power(cast(sqrtPriceX96 as double) / power(2, 96), 2)end as price,case contract_addresswhen 0x5c45b0f48c326f79b56709d8f63ce2bee7697106 then 'SUI'when 0x61C6e9E93592e535Efc1BEE07f491A517e98f6d0 then 'XRP'end as assetfrom aerodrome_base.CLPool_evt_Swapwhere contract_address in (0x5c45b0f48c326f79b56709d8f63ce2bee7697106,0x61C6e9E93592e535Efc1BEE07f491A517e98f6d0)and evt_block_time between cast('2025-10-10 20:00' as timestamp) and cast('2025-10-10 23:00' as timestamp)),dex_prices as (selecta.minute,avg(b.price / a.price) as price,a.assetfrom aerodrome_swaps aleft join weth_prices b on a.minute = b.minutegroup by a.minute, a.asset