0-MIDUntitled Query
Updated 2022-09-04
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
›
⌄
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,TO_ADDRESS
from ethereum.core.ez_token_transfers
where ORIGIN_TO_ADDRESS='0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f'
and date>=current_date-90)
select date,sum(AMOUNT_USD)as lp_volume,sum(lp_volume)over(order by date asc)as total_lp_volume
from tab1
left join tab2
on tab1.POOL_ADDRESS=tab2.TO_ADDRESS
group by 1),
act2 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)
select act2.date,lp_volume,remove_lp_volume,lp_volume-remove_lp_volume as net_lp,sum(net_lp)over(order by act2.date asc)as net_liq_pr
from act1
full outer join act2
on act1.date=act2.date
Run a query to Download Data