Diako999monthly_lending_stats_on_arbitrum
Updated 2023-03-17
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
›
⌄
with
lending as (
select distinct
symbol,
sum(asset_amount) as amount,
sum(asset_amount_usd) as amount_usd,
count(tx_hash) as transactions,
count(distinct (depositor)) as depositors,
action
from
arbitrum.sushi.ez_lending
where
symbol = 'USDT'
or symbol = 'DAI'
or symbol = 'USDC'
or symbol = 'TUSD'
or symbol = 'FRAX'
group by
symbol,
action
)
select
date_trunc('month', a.hour) as date,
amount,
amount_usd,
transactions,
transactions * a.price as volume,
depositors,
action
from
lending
join ethereum.core.fact_hourly_token_prices a on lending.symbol = a.symbol
group by
date,
amount,
amount_usd,