MLDZMNLB 5
Updated 2024-04-21
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
›
⌄
-- Average borrow duration of USDT on Aave V3
with borrow as (
SELECT
BORROWER,
min(BLOCK_TIMESTAMP) as min_borrow
from
ethereum.defi.ez_lending_borrows
where
PLATFORM = 'Aave V3'
and TOKEN_SYMBOL = 'USDT'
group by
BORROWER
),
repay as (
SELECT
PAYER,
min(BLOCK_TIMESTAMP) as min_repay
from
ethereum.defi.ez_lending_repayments r
join borrow b on r.PAYER = b.BORROWER
where
PLATFORM = 'Aave V3'
and TOKEN_SYMBOL = 'USDT'
and BLOCK_TIMESTAMP > min_borrow
group by
PAYER
)
select
AVG(DATEDIFF(Day, min_borrow, min_repay)) as "Avg duration"
from
borrow
join repay on borrow.BORROWER = repay.PAYER
QueryRunArchived: QueryRun has been archived