WITH traders AS (
SELECT
project_name,
COUNT(DISTINCT buyer_address) AS "total buyers",
COUNT(DISTINCT seller_address) AS "total sellers"
FROM arbitrum.nft.ez_nft_sales
WHERE block_timestamp >= CURRENT_TIMESTAMP - INTERVAL '30 day'
AND project_name IS NOT NULL
GROUP BY project_name
)
SELECT
project_name,
"total buyers",
"total sellers",
("total buyers" + "total sellers") AS "total traders"
FROM traders
ORDER BY "total traders" DESC
LIMIT 6;