Elprognerd3 - new users activity
Updated 2023-05-16
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 new_users AS (
SELECT
MIN(a.block_timestamp) AS min_date,
a.origin_from_address AS new_user
FROM ethereum.core.ez_dex_swaps AS a
WHERE a.platform LIKE 'uniswap%'
AND a.amount_in_usd > 0
GROUP BY new_user
),
eth_price AS (
SELECT
DATE_TRUNC('day', a.hour) AS date,
AVG(a.price) AS price_usd
FROM ethereum.core.fact_hourly_token_prices AS a
WHERE a.symbol = 'WETH'
GROUP BY 1
),
statistics AS (
SELECT
COUNT(DISTINCT DATE_TRUNC('month', a.block_timestamp)) AS months,
COUNT(DISTINCT a.origin_from_address) AS users,
COUNT(DISTINCT a.tx_hash) AS txs,
SUM(a.amount_in_usd) AS usd_volumes,
SUM(b.tx_fee * c.price_usd) AS total_fees,
users / months AS avg_users,
txs / months AS avg_txs,
usd_volumes / months AS avg_usd_volumes,
fees_usd / months AS avg_fees
FROM
ethereum.core.ez_dex_swaps AS a
JOIN ethereum.core.fact_transactions AS b ON a.tx_hash = b.tx_hash
JOIN eth_price AS c ON DATE_TRUNC('day', a.block_timestamp) = c.date
JOIN new_users AS d ON a.origin_from_address = d.new_user
WHERE
Run a query to Download Data