omer93Cryptoçunks 1
    Updated 2022-08-28
    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