bergTop 10 Token to, on Raydium with the highest Swap Volume (USD) at 2 weeks ago
    Updated 2022-12-08
    with prices as (
    select block_timestamp::date as day,
    swap_from_mint as mint,
    median (swap_to_amount/swap_from_amount) as price_usd
    from solana.core.fact_swaps
    where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDav','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 1
    group by 1, 2
    )

    select
    b.symbol "Token",
    count(distinct tx_id) "Swaps Count",
    count(distinct swapper) "Swappers Count",
    sum(price_usd * swap_to_amount) "Volume (USD)",
    avg(price_usd * swap_to_amount) "Average Volume (USD)",
    median(price_usd * swap_to_amount) "Median Amount (USD)"
    from solana.core.fact_swaps a
    join prices c on a.block_timestamp::Date = c.day and a.swap_to_mint = c.mint
    join crosschain.core.dim_asset_metadata b
    on a.swap_to_mint = b.token_address
    where a.block_timestamp >= current_date - interval '2 weeks'
    and swap_program ilike '%raydium%'
    and platform = 'solana'
    and a.succeeded = 1
    group by 1
    having "Volume (USD)" > 0
    order by 4 desc
    limit 10
    Run a query to Download Data