Drsimonwww
Updated 2023-03-14
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
›
⌄
SELECT
DATE_TRUNC('day', block_timestamp) AS day,
DATE_TRUNC('week', block_timestamp) AS week,
DATE_TRUNC('month', block_timestamp) AS month,
DATE_TRUNC('year', block_timestamp) AS year,
s.NFT_COLLECTION,
c.EVENT_CONTRACT,
c.CONTRACT_NAME,
c.ACCOUNT_ADDRESS,
COUNT(DISTINCT s.buyer) AS buyers,
COUNT(DISTINCT s.seller) AS sellers,
SUM(s.price) AS total_sales_price,
AVG(s.price) AS avg_price,
MAX(s.price) AS max_price,
MIN(s.price) AS min_price,
COUNT(DISTINCT s.currency) AS currencies,
COUNT(DISTINCT s.nft_id) AS unique_nfts,
COUNT(DISTINCT s.buyer, s.seller) AS unique_traders,
COUNT(*) AS total_sales,
COUNT(DISTINCT s.tx_id) AS nft_sales,
CASE
WHEN '{{date}}' = 'day' THEN DATE_TRUNC('day', block_timestamp)
WHEN '{{date}}' = 'week' THEN DATE_TRUNC('week', block_timestamp)
WHEN '{{date}}' = 'month' THEN DATE_TRUNC('month', block_timestamp)
WHEN '{{date}}' = 'year' THEN DATE_TRUNC('year', block_timestamp)
ELSE NULL
END AS date
FROM flow.core.ez_nft_sales s
JOIN flow.core.dim_contract_labels c ON s.NFT_COLLECTION = c.EVENT_CONTRACT
WHERE s.MARKETPLACE LIKE 'Gigantik Primary Market'
AND s.price IS NOT NULL
AND s.tx_succeeded = 'true'
GROUP BY 1,2,3,4,5,6,7,8
ORDER BY nft_sales DESC
Run a query to Download Data