Sbhn_NPcustom wallet profit nft
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 pricesol AS (
select
RECORDED_HOUR::date as date,
avg(close) as usdprice
from solana.core.fact_token_prices_hourly where SYMBOL='SOL'
group by 1),
buy as ( select
purchaser,
sum(sales_amount*usdprice) as vol_buy
from solana.core.fact_nft_sales a
join pricesol b on a.block_timestamp::date=b.date
where succeeded='TRUE'
and block_timestamp>=CURRENT_DATE- {{N_Days}}
and sales_amount >0
group by 1
),
sell as ( select
seller,
sum(sales_amount*usdprice) as vol_sell
from solana.core.fact_nft_sales a
join pricesol b on a.block_timestamp::date=b.date
where succeeded='TRUE'
and block_timestamp>=CURRENT_DATE- {{N_Days}}
and sales_amount >0
group by 1
)
select
purchaser as trader,
sum(vol_sell-vol_buy) as profit
from buy
join sell on buy.purchaser=sell.seller
where purchaser = '{{Wallet_Address}}'
group by 1
Run a query to Download Data