Ericmoore_11Cetus
Updated 2024-11-18
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
WITH swap_data AS (
SELECT
DATE_TRUNC('day', block_timestamp::date) AS date,
tx_hash,
swapper,
amount_in_usd,
amount_out_usd,
(amount_in_usd + amount_out_usd) / 2 AS total_volume_usd
FROM aptos.defi.ez_dex_swaps
WHERE platform = 'cetus'
)
SELECT
date,
COUNT(DISTINCT tx_hash) AS total_swaps,
COUNT(DISTINCT swapper) AS unique_traders,
SUM(total_volume_usd) AS total_volume_usd
FROM swap_data
WHERE date >= CURRENT_DATE - INTERVAL '7 days'
GROUP BY date
ORDER BY date DESC;
QueryRunArchived: QueryRun has been archived