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
›
⌄
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
FROM aptos.defi.ez_dex_swaps
WHERE
platform = 'thala'
AND amount_usd>0
)
SELECT
DATE_TRUNC('WEEK', dt) AS "dt",
COUNT(DISTINCT swapper) AS "Swappers",
COUNT(DISTINCT tx_hash) AS "Swaps",
SUM(amount_usd) AS "Weekly Volume($)",
AVG(amount_usd) AS "Avg Volume($)",
SUM("Weekly Volume($)") OVER (ORDER BY "dt") AS "Total Volume($)"
FROM t1
GROUP BY "dt"
QueryRunArchived: QueryRun has been archived