Yakuzasn12
    Updated 2022-11-24
    --credit : https://app.flipsidecrypto.com/velocity/queries/402d6a2b-8f25-416b-b944-3f9ea742127e
    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)

    select purchaser,
    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
    and block_timestamp::date > CURRENT_DATE - 10
    group by 1,2
    order by 3 DESC
    limit 10
    Run a query to Download Data