adriaparcerisasripae pools WETH/pETHo pool
Updated 2022-11-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
deposits as (
SELECT
trunc(block_timestamp,'day') as date,
pool_name,
sum(amount_in_usd) as deposited_volume,
count(distinct tx_hash) as deposits,
count(distinct origin_from_address) as depositors
from optimism.velodrome.ez_swaps
where pool_address in ('0x20d33ff7880f65a3554bbee9c4e9bf79812c6ef6'
) and amount_in_usd is not NULL
group by 1,2
),
withdrawals as (
select
trunc(block_timestamp,'day') as date,
pool_name,
sum(amount_out_usd) as removed_volume,
count(distinct tx_hash) as withdrawals,
count(distinct origin_to_address) as withdrawers
from optimism.velodrome.ez_swaps
where pool_address in ('0x20d33ff7880f65a3554bbee9c4e9bf79812c6ef6'
) and amount_out_usd is not NULL
group by 1,2
)
SELECT
x.date,x.pool_name,
deposited_volume,removed_volume*(-1) as removed_volumes,
deposited_volume-removed_volume as net_volume,
sum(net_volume) over (partition by x.pool_name order by x.date) as cum_net_volume,
deposits,withdrawals, deposits-withdrawals as net_deposits,
depositors, withdrawers, depositors-withdrawers as net_depositors
from deposits x
left outer join withdrawals y on x.date=y.date and x.pool_name=y.pool_name
order by 1 asc,2
Run a query to Download Data