zpencerTop Sweeps - 1 Day
    Updated 2023-04-13
    with buyers as (
    select
    project_name,
    nft_address,
    buyer_address,
    count(*) bought,
    avg(price_USD) avgPriceUSD,
    sum(price_USD) totalUSD
    from ethereum.core.ez_nft_sales
    where block_timestamp::date >= GETDATE()::DATE - 1
    and event_type not in ('redeem')
    group by project_name, nft_address, buyer_address
    ),
    agg as (
    select *,
    RANK() OVER(PARTITION BY project_name, nft_address ORDER BY bought desc) as rank
    from buyers
    )
    select top 4 project_name, nft_address, buyer_address, bought, avgpriceusd, totalusd
    from agg
    where 1=1
    -- and buyer_address not in ('0xf896527c49b44aAb3Cf22aE356Fa3AF8E331F280')
    and project_name not in ('opensea')
    and rank <= 3
    and bought > 10
    and avgPriceUSD > 100
    and totalUSD >= 10000
    order by bought desc
    Run a query to Download Data