0xsloaneDex swap volume median by swap program
Updated 2024-10-31
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
›
⌄
WITH dest_swap AS (
SELECT
CASE WHEN swap_program ilike '%raydium%' then 'raydium'
WHEN swap_program ilike '%orca%' then 'orca'
WHEN swap_program ilike '%whirlpool%' then 'orca'
WHEN swap_program ilike '%jupiter%' then 'jupiter'
WHEN swap_program ilike '%meteora%' then 'meteora'
WHEN swap_program ilike '%saber%' then 'saber'
ELSE LOWER(swap_program)
END AS swap_program_grouped
, COALESCE(swap_to_amount_usd,0) AS swap_amount_usd
FROM solana.defi.ez_dex_swaps fs
WHERE TRUE
AND block_timestamp::DATE BETWEEN DATEADD(day, -{{days_to_look_back}}, current_date()) AND current_date() - 1
AND swap_to_amount_usd > 0
)
SELECT
swap_program_grouped
, PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY swap_amount_usd) AS percentile_25_swap_volume_usd
, PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY swap_amount_usd) AS percentile_50_swap_volume_usd
, PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY swap_amount_usd) AS percentile_75_swap_volume_usd
FROM
dest_swap
GROUP BY
1
ORDER BY
3 DESC
QueryRunArchived: QueryRun has been archived