Ali3NDately XSGD Deposits / Withdrawals / Net Volume in Avalanche DEXs
Updated 2025-02-01
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 poolst as (
select *
from avalanche.defi.dim_dex_liquidity_pools
where tokens:token0 = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'
or tokens:token1 = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e')
select date_trunc ({{Date_Trunc}},block_timestamp) as date,
sum (case when to_address in (select distinct pool_address from poolst) then amount end) as Deposit,
sum (case when to_address in (select distinct pool_address from poolst) then amount_usd end) as Deposit_usd,
sum (case when from_address in (select distinct pool_address from poolst) then amount*-1 end) as Withdrawal,
sum (case when from_address in (select distinct pool_address from poolst) then amount_usd*-1 end) as Withdrawal_USD,
sum (case when to_address in (select distinct pool_address from poolst) then amount when from_address in (select distinct pool_address from poolst) then amount*-1 end) as Net_Volume,
sum (case when to_address in (select distinct pool_address from poolst) then amount_usd when from_address in (select distinct pool_address from poolst) then amount_usd*-1 end) as Net_Volume_usd,
sum (net_volume) over (order by date) as Cumulative_Net_Volume,
sum (net_volume_usd) over (order by date) as Cumulative_Net_Volume_usd
from avalanche.core.ez_token_transfers
where contract_address = '0xb2f85b7ab3c2b6f62df06de6ae7d09c010a5096e'
and (from_address in (select distinct pool_address from poolst)
or to_address in (select distinct pool_address from poolst))
group by 1
order by 1 desc
QueryRunArchived: QueryRun has been archived