farid-c9j0VMUntitled Query
    Updated 2022-09-28
    with me_price as (
    select date_trunc('day', block_timestamp) as date, sum(swap_from_amount) as from_amount, sum(swap_to_amount) as to_amount, to_amount/from_amount as sol_price
    FROM
    solana.core.fact_swaps
    where 1=1
    and swap_from_mint = 'So11111111111111111111111111111111111111112'
    and swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    group by 1
    ),
    volume as (
    SELECT
    date_trunc('day', block_timestamp) as date,mint
    sum(SALES_AMOUNT * sol_price) as volume_in_usd
    FROM solana.core.fact_nft_sales
    left JOIN me_price on block_timestamp::date=me_price.date
    WHERE
    marketplace ilike '%magic eden%' and SUCCEEDED = 'TRUE'
    and date >='2022-01-01'
    group by 1,2
    ),

    top_10 as (select
    project_name,
    sum(volume_in_usd) as amount
    from volume a left join solana.core.dim_nft_metadata b on a.mint=b.mint
    where date>= '2022-01-01'
    group by 1
    order by 2 desc
    limit 10)

    select
    date,
    project_name,
    amount,
    sum(amount) over (partition by project_name order by date) as cumu_volume
    Run a query to Download Data