ArioDEX Season - Solana's DEX top 10 swap token - volume
Updated 2022-12-05Copy 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
34
35
36
›
⌄
with prices as (
select
block_timestamp::date as date,
swap_from_mint as token,
median(swap_to_amount/swap_from_amount) as token_price
from solana.fact_swaps
where 1=1
and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_from_amount > 0
and swap_to_amount > 0
and block_timestamp >= '2022-11-01'
and succeeded = 'TRUE'
group by 1,2
),
swap_table_1 as (
SELECT
BLOCK_TIMESTAMP,
TX_ID,
SWAPPER,
SWAP_FROM_AMOUNT * token_price as Token_1_amount,
SWAP_FROM_MINT,
c.LABEL as Token_1,
SWAP_TO_MINT,
e.label as token_2
from solana.core.fact_swaps a join prices b on a.SWAP_FROM_MINT = b.token and a.BLOCK_TIMESTAMP::date = b.DATE
join solana.core.dim_labels c on a.SWAP_FROM_MINT = c.address
join solana.core.dim_labels e on a.SWAP_TO_MINT = e.address
where SWAP_FROM_AMOUNT > 0
and BLOCK_TIMESTAMP between '2022-11-01' and '2022-11-18'
and SUCCEEDED = 'TRUE'
),
before as (
SELECT
'Before FTX Collapse' as status,
concat(Token_1, '→', token_2) as Swap_pair,
sum(abs(Token_1_amount)) as Swap_Volume_USD
Run a query to Download Data