Ali3NDistribution of Solana Sport NFTs Sellers By Their Total Sold Tokens
    Updated 2022-10-09
    with sportnfts as (
    select * from solana.core.dim_labels
    where address_name in ('Hockey Heroes','Collectorz Club: The Collectorz','collectorz club gen1','The Suites','Laidback Lions','Sports Rewind')),

    SOLPricet as (
    select block_timestamp::date as day,
    avg (swap_to_amount/swap_from_amount) as SOLprice
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112' --SOL
    and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 'TRUE'
    group by 1),


    maintable as (
    select seller,
    address_name,
    count (distinct tx_id) as Sales_Count,
    count (distinct mint) as Tokens_Count,
    sum (sales_amount) as Total_SOL_Volume,
    sum (sales_amount*Solprice) as Total_USD_Volume
    from solana.core.fact_nft_sales t1 join SOLPricet t2 on t1.block_timestamp::date = t2.day
    join sportnfts t3 on t1.mint = t3.address
    where SUCCEEDED = 'TRUE'
    and sales_amount > 0
    group by 1,2)

    select address_name,
    case when Tokens_Count = 1 then '1 Token'
    when Tokens_Count > 1 and Tokens_Count <= 5 then '2 - 5 Tokens'
    when Tokens_Count > 5 and Tokens_Count <= 10 then '6 - 10 Tokens'
    else 'More Than 10 Tokens' end as type,
    count (distinct seller)
    from maintable
    Run a query to Download Data