datavortexsymbols swapped
Updated 2024-12-25
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
›
⌄
⌄
/*
SELECT
DATE_TRUNC('day', block_timestamp) AS "Date",
token_in AS "Token In",
token_out AS "Token Out",
symbol
COUNT(DISTINCT tx_hash) AS "Daily Swaps",
COUNT(DISTINCT swapper) AS "Daily Swappers",
SUM(amount_in_usd) AS "Daily Swap In Volume",
SUM(amount_out_usd) AS "Daily Swap Out Volume"
FROM
aptos.defi.ez_dex_swaps
WHERE
block_timestamp >= DATE_TRUNC('month', CURRENT_DATE)
GROUP BY
DATE_TRUNC('day', block_timestamp),
token_in,
token_out
ORDER BY
"Date" ASC,
"Token In" ASC,
"Token Out" ASC;
*/
WITH aggregated_data AS (
SELECT
DATE_TRUNC('day', block_timestamp) AS "Date",
token_in AS "Token In",
token_out AS "Token Out",
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
QueryRunArchived: QueryRun has been archived