datavortexTop Profitable Traders and NFT Collection Traded
Updated 2024-10-07
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 BuyerSales AS (
SELECT
buyer_address,
project_name,
SUM(price_usd) AS total_price_usd_buyer
FROM
arbitrum.nft.ez_nft_sales
WHERE
block_timestamp >= DATEADD(DAY, -30, CURRENT_TIMESTAMP)
GROUP BY
buyer_address, project_name
HAVING SUM(price_usd) > 0
),
SellerSales AS (
SELECT
seller_address,
project_name,
SUM(price_usd) AS total_price_usd_seller
FROM
arbitrum.nft.ez_nft_sales
WHERE
block_timestamp >= DATEADD(DAY, -30, CURRENT_TIMESTAMP)
GROUP BY
seller_address, project_name
HAVING SUM(price_usd) > 0
)
SELECT
COALESCE(s.seller_address, b.buyer_address) AS user_address,
COALESCE(b.project_name, s.project_name) AS project_name,
COALESCE(b.total_price_usd_buyer, 0) AS total_price_usd_buyer,
COALESCE(s.total_price_usd_seller, 0) AS total_price_usd_seller,
COALESCE(s.total_price_usd_seller, 0) - COALESCE(b.total_price_usd_buyer, 0) AS profit
FROM
BuyerSales b
FULL JOIN
SellerSales s ON b.buyer_address = s.seller_address
QueryRunArchived: QueryRun has been archived