hessTop Sellers
    Updated 2023-03-22
    with sol_price as ( select date(RECORDED_HOUR) as date, symbol, avg(CLOSE) as avg_price
    from solana.core.fact_token_prices_hourly
    where RECORDED_HOUR::date >= '2022-10-01'
    and symbol = 'SOL'
    group by 1,2)
    ,
    sales as ( select date(block_timestamp) as date, tx_id, purchaser,seller, ADDRESS_NAME, sales_amount, sales_amount*avg_price as volume, avg_price
    from solana.core.fact_nft_sales a left outer join sol_price b on a.block_timestamp::date = b.date
    join solana.core.dim_labels c on a.mint = c.address
    where block_timestamp::date >= '2022-10-01'
    and address_name is not null
    and SUCCEEDED = 'TRUE')
    ,
    before_new_year as ( select seller, sum(sales_amount) as total_sol , count(DISTINCT(purchaser)) as total_buyer, sum(volume) as total_volume
    from sales
    where date >= '2022-10-01' and date <= '2023-01-01'
    and volume is not null
    and address_name is not null
    group by 1
    order by 2 desc
    limit 5)
    ,
    after_new_year as ( select seller, sum(sales_amount) as total_sol , count(DISTINCT(purchaser)) as total_buyer, sum(volume) as total_volume
    from sales
    where date >= '2023-01-01'
    and volume is not null
    group by 1
    order by 2 desc
    limit 5)

    select 'Before New Year' as type , *
    from before_new_year
    UNION
    select 'After New Year' as type , *
    from after_new_year
    Run a query to Download Data