/ Fork of (#13587) Outstanding loans per asset 💶 @johaya
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
SQL query
1WITH borrows AS (
2
3 SELECT project,
4 token_symbol,
5 token_address,
6 sum(amount) AS amount -- Net borrow per day
7 FROM
8
9 (
10 SELECT project,
11 asset_address AS token_address,
12 asset_symbol AS token_symbol,
13 token_amount AS amount
14 FROM lending."borrow"
15
16 UNION ALL
17
18 SELECT project,
19 asset_address AS token_address,
20 asset_symbol AS token_symbol,
21 -token_amount AS amount
22 FROM lending."repay"
23 ) b
24 GROUP BY 1, 2, 3
25 )...