carsonbrownTop Volume by Month Launch
Updated 2022-11-21Copy 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
29
30
31
32
33
34
35
36
›
⌄
WITH mints AS (
WITH mint_txs AS (
SELECT DATE_TRUNC('MONTH', mints.BLOCK_TIMESTAMP) AS launch_month, mints.BLOCK_TIMESTAMP, mints.NFT_ADDRESS AS addr, mints.PROJECT_NAME AS name, trans.ORIGIN_FUNCTION_SIGNATURE AS SIG
FROM ethereum.core.ez_nft_mints mints
JOIN ethereum.core.fact_transactions trans
ON mints.tx_hash = trans.tx_hash
),
grouped AS (
SELECT addr, name, min(launch_month) AS launch_month
FROM mint_txs
GROUP BY 1,2
)
SELECT grouped.*, common.sig
FROM grouped
JOIN (
SELECT addr, sig
FROM (
SELECT addr, sig, count(*) AS counts
FROM mint_txs
GROUP BY addr, sig
)
QUALIFY RANK() OVER (PARTITION BY addr ORDER BY counts DESC) = 1
) common
ON grouped.addr = common.addr
),
opensea_volume AS (
SELECT NFT_ADDRESS AS addr, PROJECT_NAME AS name, count(*) AS lifetime_volume, sum(PRICE_USD) AS lifetime_trade_value
FROM ethereum.core.ez_nft_sales
WHERE PLATFORM_NAME = 'opensea'
GROUP BY 1,2
),
ranked AS (
Run a query to Download Data