nandre2024-06-04 03:22 PM
    Updated 2024-06-04
    select
    date_trunc('quarter', BLOCK_TIMESTAMP)::date AS date,
    'Liquidations' as type,
    count(DISTINCT(tx_hash)) as total_tx_liq,
    count(DISTINCT(borrower)) as total_user_liq,
    sum(LIQUIDATION_AMOUNT_USD) as total_liq_volume,
    avg(LIQUIDATION_AMOUNT_USD) as avg_liq_volume,
    sum(total_tx_liq) over (partition by type order by date) as cum_tx,
    sum(total_liq_volume) over (partition by type order by date) as cum_volume,
    avg(total_liq_volume) over (partition by type order by date asc rows between 6 preceding and current row ) as avg_7_days_moving
    from ethereum.compound.ez_liquidations,
    GROUP BY 1, 2

    QueryRunArchived: QueryRun has been archived