mahdishUntitled Query
Updated 2022-10-07
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
D as ( select date_trunc('day', block_timestamp) as day,
sum(amount_deposited) as eth_amount,
sum(amount_deposited) * avg(price) as eth_amount_usd,
count(distinct TX_HASH) as d_txCount,
count(distinct DEPOSITOR) as Depositors
from ethereum.maker.ez_deposits a
join ethereum.core.fact_hourly_token_prices b
on date_trunc('day', a.block_timestamp) = date_trunc('day', b.hour)
where a.symbol = 'WETH'
and b.symbol = 'WETH'
and day >= '2022-07-01' and day < CURRENT_DATE
group by 1),
W as ( select date_trunc('day', block_timestamp) as day,
sum(amount_withdrawn) as eth_amount,
sum(amount_withdrawn) * avg(price) as eth_amount_usd,
count(distinct TX_HASH) as w_txCount,
count(distinct WITHDRAWER) as Withdrawers
from ethereum.maker.ez_withdrawals a
join ethereum.core.fact_hourly_token_prices b
on date_trunc('day', a.block_timestamp) = date_trunc('day', b.hour)
where a.symbol = 'WETH'
and b.symbol = 'WETH'
and day >= '2022-07-01' and day < CURRENT_DATE
group by 1),
F as (select D.day,
case WHEN D.day >= '2022-09-01' and D.day < '2022-09-15' THEN 'Two weeks before the merge' WHEN D.day < '2022-09-01' THEN 'Before merge' ELSE 'After merge' end as Period,
D.eth_amount AS Deposit_eth_amount,
W.eth_amount AS Withdraw_eth_amount,
D.eth_amount - W.eth_amount as Net_eth_amount,
case when Net_eth_amount<0 then '-' else '+' end as Net_Amount_status,
W.w_txCount AS "Withdraw TX number", D.d_txCount AS "Deposit TX number",
Run a query to Download Data