tomingWhat Do Top Traders Hold? copy
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
›
⌄
-- forked from Ario / What Do Top Traders Hold? @ https://flipsidecrypto.xyz/Ario/q/edpTPYLWFD_g/what-do-top-traders-hold
WITH buy as (
select
BLOCK_TIMESTAMP,
BUYER_ADDRESS,
NFT_ADDRESS,
TOKENID,
case when PRICE_USD = 0 then (TX_FEE_USD + TOTAL_FEES_USD)
else PRICE_USD end as Buy_Price
from ethereum.core.ez_nft_sales
where BLOCK_TIMESTAMP::date >= current_date - 30
and PRICE_USD is not null
and EVENT_TYPE = 'sale'
),
sell as (
select
BLOCK_TIMESTAMP,
seller_ADDRESS,
NFT_ADDRESS,
TOKENID,
PRICE_USD as Sell_Price
from ethereum.core.ez_nft_sales
where BLOCK_TIMESTAMP::date >= current_date - 30
and PRICE_USD is not null
and EVENT_TYPE = 'sale'
),
Net as (
select
seller_ADDRESS as Trader,
sum(Sell_Price - Buy_Price) as Profit
from sell a join buy b on a.seller_ADDRESS = b.BUYER_ADDRESS and a.NFT_ADDRESS = b.NFT_ADDRESS and a.TOKENID = b.TOKENID
and a.BLOCK_TIMESTAMP > b.BLOCK_TIMESTAMP
group by 1
order by 2 desc
limit 10
Run a query to Download Data