0xaimanUntitled Query
    Updated 2022-09-16



    with kl as (with pricex as (select date_trunc('month',block_timestamp) as m, avg(swap_to_amount)/avg(swap_from_amount) as rate from solana.core.fact_swaps
    where swap_from_mint = 'So11111111111111111111111111111111111111112' and swap_to_mint='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    and swap_to_amount >0 and swap_from_amount>0
    group by 1 order by 1),

    bkm as (select date_trunc('month',block_timestamp) as month, sum(sales_amount) as tot_sales_solana ,
    sum(tot_sales_solana) OVER(ORDER BY month asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_tot_sales_solana
    from solana.core.fact_nft_sales
    group by 1 order by 1 desc
    )
    select pricex.m, rate, tot_sales_solana, tot_sales_solana*rate as sales_usd
    from pricex inner join bkm on pricex.m=bkm.month
    )

    select sum(sales_usd) as total_solana_sales_usd, case when sales_usd>0 then 'Solana' end as chain
    from kl
    group by 2


    Run a query to Download Data