omer93Cryptoçunks 1
Updated 2022-08-28Copy 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
34
35
36
›
⌄
with tab1 as (
select
seller_address ,
sum(price_usd) as amount_profit
from ethereum.core.ez_nft_sales left outer join ethereum.core.dim_labels
on nft_address = address
where label like 'cryptopunks'
and price_usd is not null
group by 1 )
, tab2 as (
select
buyer_address ,
sum(price_usd) as amount_spent
from ethereum.core.ez_nft_sales left outer join ethereum.core.dim_labels
on nft_address = address
where label like 'cryptopunks'
and price_usd is not null
group by 1 )
, tab3 as (
select
buyer_address as wallet_address,
sum(amount_profit - amount_spent) as Total_profit
from tab1 left outer join tab2 on seller_address = buyer_address
where amount_profit is not null
and amount_spent is not null
group by 1
order by 2 DESC
limit 10 )
select
date_trunc('day', block_timestamp)as dia ,
Run a query to Download Data