superflyUntitled Query
Updated 2022-11-22Copy Reference Fork
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
›
⌄
with MIN1 as (
select *
from solana.core.dim_labels
where label_type ilike '%cex%'),
Inflowt as (
select block_timestamp::Date as date,
sum (amount) as Inflow_Volume
from solana.core.fact_transfers
where tx_to in (select distinct address from MIN1)
and tx_from not in (select distinct address from MIN1)
and mint = 'So11111111111111111111111111111111111111112'
and block_timestamp >= CURRENT_DATE - 60 group by 1
),
Outflowt as (
select block_timestamp::Date as date,
sum (amount) as Outflow_Volume
from solana.core.fact_transfers
where tx_from in (select distinct address from MIN1)
and tx_to not in (select distinct address from MIN1)
and mint = 'So11111111111111111111111111111111111111112'
and block_timestamp >= CURRENT_DATE - 60 group by 1
)
select M.date,
inflow_volume as Inflow,
outflow_volume*-1 as Outflow,
inflow_volume - outflow_volume as Net_Flow,
sum(Inflow )over (order by M.date )cum_inflow,
sum(outflow) over (order by M.date )cum_outflow
from Inflowt M join Outflowt W on M.date = W.date
Run a query to Download Data