boomer77anc emissiooons
Updated 2022-02-20
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
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),
cate as (select sender, sum(UST_borrow) as total_borrow, case
when total_borrow < 10 then '1. <10'
when total_borrow between 10 and 100 then '2. 10-100'
when total_borrow between 100 and 1000 then '3. 100-1000'
when total_borrow between 1000 and 10000 then '4. 1000-10,000'
when total_borrow between 10000 and 100000 then '5. 10,000-100,000'
when total_borrow between 100000 and 1000000 then '6. 100,000-1M'
when total_borrow between 1000000 and 10000000 then '7. 1M-10M'
when total_borrow between 10000000 and 100000000 then '8. 10M-100M'
when total_borrow between 100000000 and 1000000000 then '9. 100M-1B'
else '10. Over 1B' end as borrower_category
from borrow
group by 1)
select borrower_category, count(distinct sender) as counts, sum(total_borrow)
from cate
group by 1
Run a query to Download Data