CarlOwOs_(1) DEXs new users
Updated 2022-12-06
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 first_swap AS (
SELECT
swapper,
MIN(block_timestamp) first_date
FROM
solana.core.fact_swaps
GROUP BY
1
),
daily_swap_data AS (
SELECT
swap_program AS label,
block_timestamp::DATE AS date,
COUNT(DISTINCT s.swapper) AS users
FROM
solana.core.fact_swaps s
LEFT JOIN first_swap f ON f.swapper = s.swapper
WHERE
block_timestamp >= '2022-07-01' -- 5 months
AND block_timestamp = first_date
GROUP BY
1, 2
),
cumulative AS (
SELECT
*,
SUM(users) OVER(ORDER BY date) AS cumulative_users,
AVG(users) OVER (ORDER BY date ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) AS new_users_7D_ma
FROM
daily_swap_data
)
SELECT
*
FROM
cumulative
Run a query to Download Data