Skip to content
Dune Analytics

@johaya / Fork of (#1961) Compound Outstanding Debt By Asset

Fork of (#1961) Compound Outstanding Debt By Asset

Loading
 

About queries and results

Dune Analytics lets you explore, create, and share Ethereum analytics. You can find an endless amount of great queries and dashboards on Dune.

We have decoded Ethereum smart contract data so you can do powerful analysis with simple SQL queries and visualise the query results into beautiful graphs.

Dune Analytics is free for everyone forever. If you want extra features like private queries, export your results and more check out our Pro plan.

SQL query results

Loading
 

SQL query

1SELECT
2week,
3token,
4sum(sum(borrow)) over (partition by token order by week)*avg(p.price) as outstanding
5FROM
6(
7SELECT
8date_trunc('week', block_time) as week,
9token_symbol as token,
10sum(borrow_amount) as borrow
11FROM compound."view_borrow"
12GROUP BY 1,2
13UNION 
14SELECT
15date_trunc('week', block_time) as week,
16token_symbol as token,
17sum(-repay_amount) as borrow
18FROM compound."view_repay_borrow"
19GROUP BY 1,2
20) net
21LEFT JOIN prices.usd p ON net.week = p.minute
22WHERE p.symbol = net.token
23GROUP BY 1,2
24ORDER BY 1 desc
25

Result visualizations

Compound v2: Outstanding Debt Per Asset Per Week ($)Fork of (#1961) Compound Outstanding Debt By Asset

Loading