Query editor
-- This query has been migrated to run on DuneSQL.-- If you need to change back because you’re seeing issues, use the Query History view to restore the previous version.-- If you notice a regression, please email [email protected].WITHcollateral_liquidated AS (SELECTDATE_TRUNC('day', block_time) AS day,SUM("seizeTokens" / CAST(1e13 AS DOUBLE) * p.price) AS collateral_liquidated_usdFROMcompound_v2_ethereum.cErc20_evt_LiquidateBorrow AS mLEFT JOIN ethereum."transactions" AS tx ON m.evt_tx_hash = tx.hashINNER JOIN prices.usd AS p ON p.minute = DATE_TRUNC('minute', block_time)WHEREp.blockchain is nulland p.symbol = 'ETH'GROUP BY1ORDER BY1 DESCLIMIT100),liquidations AS (SELECTDATE_TRUNC('day', block_time) AS day,COUNT("call_tx_hash") AS liquidationsFROMcompound_v2_ethereum.cEther_call_liquidateBorrow AS sLEFT JOIN ethereum."transactions" AS tx ON s.call_tx_hash = tx.hashWHEREcall_success = TRUEGROUP BY1ORDER BY1 DESCLIMIT100)SELECTcollateral_liquidated."day",SUM("collateral_liquidated_usd") AS collateral_liquidated_usd,SUM("liquidations") AS number_of_liquidationsFROMcollateral_liquidatedLEFT JOIN liquidations ON collateral_liquidated.day = liquidations.dayGROUP BY1ORDER BY1 DESCLIMIT100