Afonso_DiazUntitled Query
Updated 2023-02-04
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
t1 as (
select
seller as user,
mint,
min(block_timestamp) as max_day,
avg(sales_amount) as sell_amount
from solana.core.fact_nft_sales
group by 1, 2
),
t2 as (
select
purchaser as user,
mint,
min(block_timestamp) as min_day,
avg(sales_amount) as buy_amount
from solana.core.fact_nft_sales
group by 1, 2
),
t3 as (
select
t2.user as purchaser,
sum(buy_amount - nvl(sell_amount, 0)) as profit_sol,
avg(datediff('hour', min_day, max_day)) as average_holding_time
from t2
left join t1
using(mint, user)
where min_day > current_date - 90
group by 1
having average_holding_time > 0
order by 2 desc
limit 200
)
Run a query to Download Data