yasmin-n-d-r-hjoly
Updated 2023-09-10
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 data AS (
SELECT
DATE_TRUNC('week', block_timestamp) AS date,
count(distinct tx_id) AS sales_count,
sum(CAST(event_data:salePrice AS DECIMAL(18, 8))) AS sales_volume,
round(avg(CAST(event_data:salePrice AS DECIMAL(18, 8))), 0) AS avg_NFT_price,
min(CAST(event_data:salePrice AS DECIMAL(18, 8))) AS floor_price,
count(distinct event_data:buyer) AS unique_buyers
FROM
flow.core.fact_events
WHERE
tx_succeeded = true
AND event_type = 'ListingCompleted'
AND event_data:nftType = 'A.699bf284101a76f1.JollyJokers.NFT'
AND event_data:buyer IS NOT NULL
AND event_data:salePrice IS NOT NULL
AND event_data:purchased = 'true'
GROUP BY 1
)
SELECT
date,
sales_count,
sum(sales_count) OVER (ORDER BY date) AS total_sales,
sales_volume,
sum(sales_volume) OVER (ORDER BY date) AS total_sales_volume,
avg_NFT_price,
floor_price,
unique_buyers
FROM
data
ORDER BY 1 ASC;
Run a query to Download Data