0-MIDvelodrome Vs. sushiswap, LP remove volume(USD)
Updated 2023-04-13
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
›
⌄
with act1 as (
with tab1 as (
select POOL_ADDRESS
from ethereum.core.dim_dex_liquidity_pools
where PLATFORM='sushiswap'),
tab2 as (
select BLOCK_TIMESTAMP::date as date,AMOUNT_USD,FROM_ADDRESS
from ethereum.core.ez_token_transfers
where ORIGIN_TO_ADDRESS='0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f'
and date>=current_date-90)
select date,sum(AMOUNT_USD)as remove_lp_volume,sum(remove_lp_volume)over(order by date asc)as total_remove_lp_volume
from tab1
left join tab2
on tab1.POOL_ADDRESS=tab2.FROM_ADDRESS
group by 1),
act2 as (
select BLOCK_TIMESTAMP::date as date,sum(TOKEN0_AMOUNT_USD+TOKEN1_AMOUNT_USD)as lp_rem_vol
,sum(lp_rem_vol)over(order by date asc)as total
from optimism.velodrome.ez_lp_actions
where LP_ACTION='withdraw'
and date>=current_date-90
group by 1)
select act2.date,remove_lp_volume as sushi_remove_lp_volume,total_remove_lp_volume as total_sushi_remove_lp_volume
,lp_rem_vol as velodrome_lp_remove_volume,total as total_velodrome_lp_remove_volume
from act1
full outer join act2
on act1.date=act2.date
Run a query to Download Data