legionUntitled Query
Updated 2022-08-31Copy 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
›
⌄
with Buyer as ( select
tokenid as T1,
seller_address ,
sum(price) as Sell_Volume
from ethereum.core.ez_nft_sales
where project_name = 'cryptopunks' and event_type = 'sale' and seller_address != '0x0000000000000000000000000000000000000000'
and price is not null AND tx_hash not in ('0x92488a00dfa0746c300c66a716e6cc11ba9c0f9d40d8c58e792cc7fcebf432d0')
group by 1,2 )
, Seller as (
select
tokenid as T2,
buyer_address ,
sum(price) as Buy_Volume
from ethereum.core.ez_nft_sales
where project_name = 'cryptopunks' and event_type = 'sale' and seller_address != '0x0000000000000000000000000000000000000000'
and price is not null AND tx_hash not in ('0x92488a00dfa0746c300c66a716e6cc11ba9c0f9d40d8c58e792cc7fcebf432d0')
group by 1,2 )
select buyer_address as Trader, sum(Sell_Volume - Buy_Volume) as Profit ,rank() over (order by Profit desc) as Rank
from Buyer left outer join Seller on seller_address = buyer_address and T1=T2
where Sell_Volume is not null and Buy_Volume is not null
group by Trader order by Profit DESC limit 10
Run a query to Download Data