MLDZMNab11
    Updated 2023-09-14
    with buy as (
    select
    buyer_address as buyer,
    sum(price_usd) as volume_usd_buy
    from ethereum.core.ez_nft_sales
    where price_usd is not NULL
    and CREATOR_FEE_USD is not null
    and PROJECT_NAME='art blocks'
    group by 1 having volume_usd_buy is not null
    ),
    sel as (select
    seller_address as seller,
    sum(price_usd) as volume_usd_sell
    from ethereum.core.ez_nft_sales
    where price_usd is not NULL
    and CREATOR_FEE_USD is not null
    and PROJECT_NAME='art blocks'
    group by 1 having volume_usd_sell is not null
    )
    select
    buyer as nft_trader,
    -volume_usd_buy as "Total buy",
    volume_usd_sell as "Total sell",
    sum (volume_usd_sell - volume_usd_buy) as profit_usd
    from buy join sel on buy.buyer = sel.seller
    group by 1,2,3
    order by 4 DESC
    limit 10
    Run a query to Download Data