Ali3NDistribution of UNI SNX MKR Borrowers By Their Borrows Count AAVE v2
Updated 2023-03-08
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
›
⌄
with maintable as (
select borrower_address,
symbol,
count (Distinct tx_hash) as Borrows_Count,
sum (borrowed_usd) as Total_Borrowed_USD,
avg (borrowed_usd) as Average_Borrowed_USD,
median (borrowed_Usd) as Median_Borrowed_USD,
min (borrowed_Usd) as Minimum_Borrowed_USD,
max (borrowed_Usd) as Maximum_Borrowed_USD,
sum (borrowed_tokens) as Total_Borrowed_Token,
avg (borrowed_tokens) as Average_Borrowed_Token
from ethereum.aave.ez_borrows
where aave_version = 'Aave V2'
and symbol in ('SNX','UNI','MKR')
group by 1,2)
select symbol,
case when borrows_count = 1 then 'Once'
when borrows_Count > 1 and borrows_Count <= 5 then '2 - 5 Borrows'
when borrows_Count > 5 and borrows_Count <= 10 then '6 - 10 Borrows'
when borrows_Count > 10 and borrows_Count <= 25 then '11 - 25 Borrows'
when borrows_Count > 25 and borrows_Count <= 50 then '26 - 50 Borrows'
when borrows_Count > 50 and borrows_Count <= 100 then '51 - 100 Borrows'
else 'More Than 100 Borrows' end as type,
count (Distinct borrower_address)
from maintable
group by 1,2
order by 3 desc
Run a query to Download Data