SajjadiiiSolana NFT Comparison 1
    Updated 2022-09-17
    with solprice as (
    select date_trunc('day', block_timestamp) as date,
    avg(swap_to_amount/swap_from_amount) as sol_price
    from solana.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112' --wSOL
    and swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --USDC
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 'TRUE'
    group by 1),

    solana_tab as (
    select block_timestamp::date as date ,
    count(distinct tx_id) as total_sale ,
    count(distinct purchaser) as total_unique_buyer,
    sum(sales_amount*sol_price) as total_volume
    from solana.core.fact_nft_sales a
    join solprice b
    on a.block_timestamp::date = b.date
    where block_timestamp::date >= '2022-06-15'
    and succeeded = 'TRUE'
    group by 1
    ),

    final_solana as (
    select
    date ,
    sum (total_sale) as "Total Sales" ,
    sum ("Total Sales") over (order by date) as "Cumulative Sales",
    sum (total_unique_buyer) as "Total Unique Buyers",
    sum ("Total Unique Buyers") over (order by date) as "Cumulative Unique Buyers",
    sum (total_volume) as "Total Volume",
    sum ("Total Volume") over (order by date) as "Cumulative Volume"
    from solana_tab
    where date >= '2022-06-15'
    Run a query to Download Data