0xHaM-dNFT Hodl Time (Past Month)
Updated 2023-02-03Copy 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
›
⌄
with buyerTb as (
SELECT
PURCHASER,
Mint,
min(block_timestamp) as buying_date,
avg(sales_amount) as buying_price
FROM solana.core.fact_nft_sales
GROUP BY 1,2
), sellerTb as (
SELECT
SELLER,
s.Mint,
min(block_timestamp) as selling_date,
avg(sales_amount) as selling_price
FROM solana.core.fact_nft_sales s join buyerTb b on s.SELLER = b.PURCHASER and s.Mint = b.mint
GROUP BY 1,2
)
-- , topTraders as (
SELECT
PURCHASER,
LEFT(b.PURCHASER, 4) || '...' || RIGHT(b.PURCHASER, 4) as short_add,
sum(buying_price - selling_price) as profit_sol,
avg(datediff('hour', buying_date::date, selling_date::date)) as avg_hodl_time
FROM buyerTb b left outer join sellerTb s on PURCHASER = SELLER and b.mint = s.mint and selling_date > buying_date
where not b.mint is NULL
AND not seller is NULL
GROUP BY 1,2
HAVING NOT profit_sol is NULL
AND AVG_HODL_TIME > 0
ORDER BY 3 DESC
LIMIT 100
Run a query to Download Data