0xsloaneDex swap volume USD market share 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
30
31
32
33
34
35
36
›
⌄
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
, fs.tx_id
--, COUNT(DISTINCT fs.swapper) AS cnt_users
-- , SUM(swap_to_amount_usd)/COUNT(DISTINCT fs.tx_id) AS swap_amount_per_tx
-- , SUM(swap_to_amount_usd)/COUNT(DISTINCT fs.swapper) AS swap_amount_per_wallet
-- , COUNT(DISTINCT fs.tx_id)/COUNT(DISTINCT fs.swapper) AS tx_per_wallet
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
--GROUP BY 1
)
, tmp_agg AS (
SELECT
--swap_date
swap_program_grouped
, CASE
WHEN swap_amount_usd >= 0 AND swap_amount_usd < 1 THEN 'a. 0-1'
WHEN swap_amount_usd >= 1 AND swap_amount_usd < 10 THEN 'b. 1-10'
WHEN swap_amount_usd >= 10 AND swap_amount_usd < 100 THEN 'c. 10-100'
WHEN swap_amount_usd >= 100 AND swap_amount_usd < 500 THEN 'd. 100-500'
WHEN swap_amount_usd >= 500 AND swap_amount_usd < 1000 THEN 'e. 500-1,000'
WHEN swap_amount_usd >= 1000 AND swap_amount_usd < 5000 THEN 'f. 1,000-5,000'
WHEN swap_amount_usd >= 5000 AND swap_amount_usd < 10000 THEN 'g. 5,000-10,000'
WHEN swap_amount_usd >= 10000 AND swap_amount_usd < 100000 THEN 'h. 10,000-100,000'
WHEN swap_amount_usd >= 100000 THEN 'i. 100,000+'
QueryRunArchived: QueryRun has been archived