datavortextotal
Updated 2024-11-26
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 total AS (
SELECT
SUM(amount_in_usd) AS "total swap volume",
COUNT(DISTINCT tx_hash) AS "total swaps",
COUNT(DISTINCT origin_from_address) AS "total users"
FROM
avalanche.defi.ez_dex_swaps
WHERE
block_timestamp >= '2024-01-01'
AND block_timestamp <= '2024-12-31'
AND platform = 'uniswap-v3'
),
averages AS (
SELECT
"total swap volume" / NULLIF("total users", 0) AS "average swap volume per user",
"total swaps" / NULLIF("total users", 0) AS "average swaps per user"
FROM
total
),
weekly AS (
SELECT
DATE_TRUNC('week', block_timestamp) AS "timeline",
SUM(amount_in_usd) AS "weekly swap volume",
COUNT(DISTINCT tx_hash) AS "weekly swaps",
COUNT(DISTINCT sender) AS "weekly users"
FROM
avalanche.defi.ez_dex_swaps
WHERE
block_timestamp >= '2024-01-01'
AND block_timestamp <= '2024-12-31'
AND platform = 'uniswap-v3'
GROUP BY
DATE_TRUNC('week', block_timestamp)
),
QueryRunArchived: QueryRun has been archived