Elprognerd1 - overall eth
Updated 2023-05-16Copy Reference Fork
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
›
⌄
WITH eth_price AS (
SELECT
date_trunc('day', hour) AS date,
avg(price) AS price_usd
FROM ethereum.core.fact_hourly_token_prices
WHERE symbol = 'WETH'
GROUP BY 1
)
SELECT
count(DISTINCT a.origin_from_address) AS total_users,
count(DISTINCT a.tx_hash) AS total_transactions,
sum(a.amount_in_usd) AS total_usd_volumes,
sum(b.tx_fee * c.price_usd) AS total_fees_usd,
count(DISTINCT a.origin_from_address) / count(DISTINCT date_trunc('month', a.block_timestamp)) AS avg_users,
count(DISTINCT a.tx_hash) / count(DISTINCT date_trunc('month', a.block_timestamp)) AS avg_transactions,
sum(a.amount_in_usd) / count(DISTINCT date_trunc('month', a.block_timestamp)) AS avg_usd_volumes,
sum(b.tx_fee * c.price_usd) / count(DISTINCT date_trunc('month', a.block_timestamp)) AS avg_fees_usd
FROM ethereum.core.ez_dex_swaps a
JOIN ethereum.core.fact_transactions b ON a.tx_hash = b.tx_hash
JOIN eth_price c ON date_trunc('day', a.block_timestamp) = c.date
WHERE
a.block_timestamp > current_date - interval '365 days'
AND a.block_timestamp < current_date
AND a.platform LIKE 'uniswap%'
AND a.amount_in_usd IS NOT NULL
AND a.amount_in_usd > 0
Run a query to Download Data