mehdimarjanMax, Min & Average Sales Amount
Updated 2022-10-31Copy 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
›
⌄
WITH price AS(
SELECT hour::date AS price_day, AVG(price) AS price
FROM ethereum.core.fact_hourly_token_prices
WHERE TOKEN_ADDRESS = '0xd31a59c85ae9d8edefec411d448f90841571b89c'
GROUP BY 1
ORDER BY 1
),
details AS (
SELECT block_timestamp::DATE AS DAY, marketplace, mint,
tx_id, sales_amount, sales_amount*price AS sales_amount_usd
FROM solana.core.fact_nft_sales
INNER JOIN price ON price_day = block_timestamp::DATE
WHERE marketplace in ('hyperspace','coral cube')
)
SELECT marketplace,
MAX(sales_amount) AS max_amount,
MAX(sales_amount_usd) AS max_amount_usd,
MIN(sales_amount) AS min_amount,
MIN(sales_amount_usd) AS min_amount_usd,
AVG(sales_amount) AS avg_amount,
AVG(sales_amount_usd) AS avg_amount_usd
FROM details d
INNER JOIN solana.core.dim_labels l
ON l.address = d.mint
GROUP BY 1
ORDER BY 1
Run a query to Download Data