Skip to content
Dune Analytics

@MatteoLeibowitz / Compound Outstanding Debt

Compound v2: All Time Outstanding Debt ($)Compound Outstanding Debt

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

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

SQL query results

Loading