tomwanhhic21 uniswap pool liquidity
Updated 2023-09-21
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 deposit as (
select address, symbol, sum(amount) from (
select from_address as address, symbol, sum(amount) as amount
from ethereum.core.ez_token_transfers
where lower(to_address) = lower('0x15E71C06244F5CaB0B1aBDb01807ca248D314BB9')
group by 1,2
union all
select to_address as address, symbol, sum(amount*-1) as amount
from ethereum.core.ez_token_transfers
where lower(from_address) = lower('0x15E71C06244F5CaB0B1aBDb01807ca248D314BB9')
group by 1,2
)a group by 1,2
),
withdrawal as (
select date(block_timestamp) as day, symbol, sum(amount*-1) as withdrawal
from ethereum.core.ez_token_transfers
where lower(from_address) = lower('0x15E71C06244F5CaB0B1aBDb01807ca248D314BB9')
group by 1,2
),
base as (
select date_day as day, symbol
from
crosschain.core.dim_dates
cross join (select distinct symbol from deposit)
where
date_day >= date(2023-09-12)
and date_day<=date(current_date())
)
select * from (
select *, sum(net_change) over (partition by symbol order by day) as balance from (
select a.day, a.symbol, coalesce(deposit,0), coalesce(withdrawal,0), coalesce(deposit,0)+coalesce(withdrawal,0) as net_change
from base a
left join deposit b
Run a query to Download Data