Sbhn_NPswap stats between DEXs
    Updated 2022-12-07
    with priceosmo as (
    select date_trunc('day',recorded_at) as day,
    address,
    symbol,
    avg (price) as USDPrice
    from osmosis.core.dim_prices t1
    join osmosis.core.dim_labels t2 on t1.symbol = t2.project_name
    where symbol != 'IOV'
    and recorded_at >= '2022-11-01'
    group by 1,2,3),

    pricesolana as (
    select date_trunc('day',block_timestamp) as day,
    swap_from_mint as token,
    median (swap_to_amount/swap_from_amount) as USDPrice
    from solana.fact_swaps
    where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
    and swap_to_amount > 0
    and swap_from_amount > 0
    and block_timestamp >= '2022-11-01'
    and succeeded = 'TRUE'
    group by 1,2)

    select 'Sushiswap' as dex,
    date_trunc('day',block_timestamp) as date,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT origin_from_address) as swappers,
    sum(amount_in_usd) as volume_usd,
    avg(amount_in_usd) as average_volume_usd
    from ethereum.sushi.ez_swaps
    where date >= '2022-11-01'
    group by 1,2

    UNION

    Run a query to Download Data