CryptoIcicleAAVE-30. [Hard] Means of Repayment - Token
Updated 2021-11-06
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
›
⌄
-- When people repay their loans, do they liquidate themselves and use collateral growth to do so,
-- or are they paying off their loan with external (to Aave) funding? How does this relate to the collateral's price?
with liquidations as (
select
*
from
aave.liquidations
), repayments_after_liquidation as (
select
*
from
aave.repayments r
join liquidations l on l.debt_token_symbol = r.symbol
and l.block_timestamp < r.block_timestamp
and l.borrower = r.borrower
and l.liquidated_amount_usd > r.repayed_usd
)
(
select
count(*) as number,
symbol,
'total repayments' as type
from
aave.repayments
group by type, symbol
)
union
(
select
count(*) as number,
symbol,
'total repayments after liquidations' as type
from
repayments_after_liquidation
group by type, symbol
Run a query to Download Data