with borrow as (select date_trunc('day', block_timestamp) as dt, sender, sum(amount) as UST_borrow,
count(distinct sender) as borrower_count, avg(amount) as avg_borrow
from anchor.borrows
where date(block_timestamp) >= CURRENT_DATE - 90
group by 1,2)
select dt, sum
from borrow
group by 1
order by 2 desc