maybeyonassol_perform_price
    Updated 2022-07-10
    with
    price_data as (
    select
    block_timestamp,
    swap_program,
    case
    when swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then swap_from_amount/swap_to_amount
    else swap_to_amount/swap_from_amount end as price
    from solana.core.fact_swaps
    where
    (
    (swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and swap_to_mint = 'So11111111111111111111111111111111111111112')
    or
    (swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and swap_from_mint = 'So11111111111111111111111111111111111111112')
    )
    and swap_from_amount > 0
    )

    select
    date(block_timestamp) as date,
    swap_program,
    median(price) as price
    from price_data
    group by 1,2
    -- limit 100
    Run a query to Download Data