Query editor
withu2 as (selectDATE_TRUNC('hour', s.evt_block_time) as time,SUM(e.price * (s.amount1In + s.amount1Out))/ SUM(s.amount0In + s.amount0Out) as pricefromuniswap_v2_ethereum.Pair_evt_Swap sjoinprices.usd eon DATE_TRUNC('minute', s.evt_block_time) = e.minutewheres.contract_address = 0xb13201b48b1e61593df055576964d0b3aab66ea3 and -- WETH <=> LQTY paire.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHand s.evt_block_time > CAST('2021-04-04' AS TIMESTAMP)and e.minute > CAST('2021-04-04' AS TIMESTAMP)and s.evt_block_time < CAST('2021-05-12' AS TIMESTAMP)and e.minute < CAST('2021-05-12' AS TIMESTAMP)group by 1),u3 as (selectDATE_TRUNC('hour', s.evt_block_time) as time,AVG(e.price * POWER(s.sqrtPriceX96 / POWER(2, 96), 2)) as pricefromuniswap_v3_ethereum.Pair_evt_Swap sjoinprices.usd eon DATE_TRUNC('minute', s.evt_block_time) = e.minutewheres.contract_address = 0xd1d5a4c0ea98971894772dcd6d2f1dc71083c44e and -- WETH <=> LQTY paire.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHand s.evt_block_time >= CAST('2021-05-12' AS TIMESTAMP)and e.minute >= CAST('2021-05-12' AS TIMESTAMP)-- and s.evt_block_time < '2021-07-07'-- and e.minute < '2021-07-07'group by 1),u as (-- select * from d-- union allselect * from u2union allselect * from u3),p as (selectDATE_TRUNC('day', time) as time,AVG(price) as pricefrom ugroup by 1),c as (selectDATE_TRUNC('day', block_time) as time,SUM(value / 1e18 * price) as liquidatedCollUsd