select
date(block_timestamp) as block_date,
count(*) as total_liquidations_per_day
from terra.msgs
where substring(msg_value:execute_msg::string, 3, 20) = 'liquidate_collateral'
and tx_status = 'SUCCEEDED'
and block_date >= CURRENT_DATE() - 90
group by block_date;
-- new depositor into earn, new borrower, average balance of new borrower, average balance of new earner, weekly deposit into earn vs weekly borrow