saeedmznUSDC Declining on Solana - inflows outflows cexes
Updated 2022-10-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 CEXes as (
select ADDRESS , ADDRESS_NAME
from solana.core.dim_labels
where LABEL_TYPE ='cex'
group by 1 ,2
),
outflow as (
select
BLOCK_TIMESTAMP::date daily ,
-- ADDRESS_NAME ,
sum (AMOUNT) outflow_amount
from solana.core.fact_transfers join CEXes on ADDRESS = TX_FROM
where mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
and BLOCK_TIMESTAMP ::date >= '2022-01-01'
group by 1
),
inflow as (
select
BLOCK_TIMESTAMP::date daily ,
-- ADDRESS_NAME ,
sum (AMOUNT) inflow_amount
from solana.core.fact_transfers join CEXes on ADDRESS = TX_TO
where mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
and BLOCK_TIMESTAMP ::date >= '2022-01-01'
group by 1
)
select date_trunc(week,daily) weekly ,
-- ADDRESS_NAME,
(inflow_amount - outflow_amount ) USDC_amount ,
sum (USDC_amount) over (order by weekly) cum_USDC_amount
from outflow join inflow using (daily )
group by 1,2
-- ,
-- balances as (
-- select address ,
-- (zeroifnull(transferred_to_amount) -zeroifnull( transferred_from_amount)) balance
Run a query to Download Data