datavortexTop Swapped Pairs
Updated 2024-12-24
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 aggregated_data AS (
SELECT
CONCAT(symbol_in, '-', symbol_out) AS "Token Pair Symbol",
COUNT(DISTINCT tx_hash) AS "Total Swaps",
SUM(amount_in_usd) AS "Total Swap In Volume"
FROM
aptos.defi.ez_dex_swaps
WHERE
block_timestamp >= DATE_TRUNC('month', CURRENT_DATE)
AND symbol_in IS NOT NULL
AND symbol_out IS NOT NULL
GROUP BY
token_in,
token_out,
symbol_in,
symbol_out
),
ranked_data AS (
SELECT
"Token Pair Symbol",
"Total Swaps",
"Total Swap In Volume",
RANK() OVER (ORDER BY "Total Swaps" DESC) AS swap_rank
FROM
aggregated_data
)
SELECT
"Token Pair Symbol",
"Total Swaps",
"Total Swap In Volume"
FROM
ranked_data
WHERE
swap_rank <= 15
ORDER BY
"Total Swaps" DESC;
QueryRunArchived: QueryRun has been archived