shenronCopy of MEDIAN % Borrowed
Updated 2021-05-03
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
31
32
33
34
35
36
›
⌄
-- WHAT % BORROWING POWER DOES THE TYPICAL WALLET HAVE?
-- HOW HAS THAT CHANGED OVER TIME?
-- HOW DOES THAT COMPARE TO WHALES?
-- DOES IT VARY BY MARKET?
WITH deposits AS (
SELECT supplier
, SUM(supplied_base_asset_usd) AS deposits
FROM compound.deposits
GROUP BY 1,2
HAVING SUM(supplied_base_asset_usd) > 0
)
, borrows AS (
SELECT borrower
, SUM(loan_amount_usd) AS loans
FROM compound.borrows
GROUP BY 1,2
)
, ratio as (
SELECT ROUND(SUM(deposits)*1.0/SUM(loans),5) AS pct_borrowed
FROM deposits d JOIN borrows b ON d.supplier = b.borrower
WHERE supplier in
)
Run a query to Download Data