bergRate of Swap from/to
    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
    ),

    swap_from as (
    select
    b.symbol "Token",
    count(distinct tx_id) "Swaps Count",
    sum(price_usd * swap_to_amount) "Volume (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 b.symbol in ('USDC', 'USDT', 'SOL', 'RAY', 'STSOL', 'ETH')
    and a.succeeded = 1
    group by 1
    having "Volume (USD)" > 0
    ),

    swap_to as (
    select
    b.symbol "Token",
    count(distinct tx_id) "Swaps Count",
    sum(price_usd * swap_from_amount) "Volume (USD)"
    from solana.core.fact_swaps a
    Run a query to Download Data