SELECT
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_trunc('day',block_timestamp) between CURRENT_DATE-interval'{{last_period}}, 1 day' AND CURRENT_DATE-1