Hossein3 copy
Updated 2024-07-27
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
›
⌄
-- forked from 3 @ https://flipsidecrypto.xyz/studio/queries/59834d49-3262-49ff-9ab6-d11995de63dd
WITH t1 AS (
SELECT
block_timestamp::date AS dt,
tx_hash,
symbol_in,
symbol_out,
swapper,
coalesce(amount_in_usd, amount_out_usd) AS amount_usd,
CASE
WHEN symbol_in < symbol_out THEN CONCAT(symbol_in, ' - ', symbol_out)
ELSE CONCAT(symbol_out, ' - ', symbol_in)
END AS token_pair
FROM aptos.defi.ez_dex_swaps
WHERE
platform = 'thala'
AND amount_usd>0
)
SELECT
token_pair AS "Token Pair",
COUNT(DISTINCT swapper) AS "Swappers",
COUNT(DISTINCT tx_hash) AS "Swaps",
SUM(amount_usd) AS "Total Volume($)",
AVG(amount_usd) AS "Avg Volume($)"
FROM t1
GROUP BY 1
ORDER BY "Swaps" DESC
LIMIT 10
QueryRunArchived: QueryRun has been archived