SELECT
date_trunc('{{interval}}', block_timestamp) as date,
count(DISTINCT tx_hash) as n_liquidations,
count(DISTINCT borrower) as n_liquidated_wallet,
avg(liquidated_amount_usd) as avg_liquidated_amnt_usd,
sum(liquidated_amount_usd) as total_liquidated_amnt_usd
FROM
ethereum.aave.ez_liquidations
WHERE
date <= CURRENT_DATE -1
GROUP BY
date