Popex404Cex Activity in Solana by SOL
Updated 2023-01-18Copy 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 CEX AS (
SELECT *
FROM solana.core.dim_labels
WHERE label_type ilike '%cex%'
),
Inflow AS (
SELECT date_trunc('day',block_timestamp) as date,
sum (amount) AS Volume_In
FROM solana.core.fact_transfers
WHERE tx_to in (select distinct address from CEX)
AND tx_from not in (select distinct address from CEX)
and mint = 'So11111111111111111111111111111111111111112'
and block_timestamp >= '2022-11-02'
group by 1),
Outflow as (
select date_trunc('day',block_timestamp) as date,
sum (amount) as Volume_Out
from solana.core.fact_transfers
where tx_from in (select distinct address from CEX)
and tx_to not in (select distinct address from CEX)
and mint = 'So11111111111111111111111111111111111111112'
and block_timestamp >= '2022-11-02'
group by 1)
select t1.date,
Volume_IN,
Volume_Out*-1 as Volume_OUT,
Volume_IN - Volume_Out as Net_Volume
from Inflow t1 join Outflow t2 on t1.date = t2.date
Run a query to Download Data