Query editor
withuniswap3 as (selectDATE_TRUNC('hour', swap."evt_block_time") as "time",AVG("price" * power((swap."sqrtPriceX96" / CAST(POWER(2, 96) AS DOUBLE)),2)) as "price"fromuniswap_v3_ethereum.Pair_evt_Swap swapjoin prices."usd" usprice on DATE_TRUNC('minute', swap."evt_block_time") = usprice."minute"whereswap.contract_address = 0xd1d5a4c0ea98971894772dcd6d2f1dc71083c44e -- WETH <=> LQTY pairand usprice.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHgroup by1),uniswap3Price as (selectDATE_TRUNC('day', time) as "time",AVG("price") as "price"fromuniswap3group by1),collateralLiquidated as (selectDATE_TRUNC('day', evt_block_time) as "time",SUM(_liquidatedColl / 1e18 * price) as "liquidatedCollUsd"fromliquity_ethereum.TroveManager_evt_Liquidation liquidationjoin prices."usd" usprice on DATE_TRUNC('minute', liquidation."evt_block_time") = usprice.minuteand usprice.blockchain = 'ethereum'and usprice.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHGROUP by1order by1 desc),debtLiquidated as (selectDATE_TRUNC('day', evt_block_time) as "time",SUM(value / 1e18) as "liquidatedDebtLusd"fromliquity_ethereum.LUSD_evt_Transfer transferwheretransfer."from" = 0x66017D22b0f8556afDd19FC67041899Eb65a21bband -- StabilityPooltransfer."to" = 0x0000000000000000000000000000000000000000 -- burngroup by1),liquidation as (select*