hessUniswap Vs. Raydium
    Updated 2022-09-30
    with uniswap as ( select trunc(block_timestamp,'week') as date, count(DISTINCT(tx_hash)) as tx,
    count(DISTINCT(origin_from_address)) as user, sum(AMOUNT_IN_USD) as volume,
    sum(volume) over (order by date asc) as cum_volume, sum(tx) over (order by date asc) as cum_tx,
    avg(amount_in_usd) as avg_volume
    from ethereum.core.ez_dex_swaps
    where platform = 'uniswap-v2' and block_timestamp::date >= '2022-01-01'
    group by 1)
    ,
    raydium as ( select date(block_timestamp) as swap_date, tx_id, swapper, swap_from_amount,SWAP_FROM_MINT
    from solana.core.fact_swaps
    where SWAP_PROGRAM ilike '%raydium%' and block_timestamp::date >= '2022-01-01')
    ,
    sol_price as ( select date(block_timestamp) as p_date, a.swap_from_mint , (sum(SWAP_TO_AMOUNT)/sum(a.SWAP_FROM_AMOUNT)) as price
    from solana.core.fact_swaps a join raydium b on a.SWAP_FROM_MINT = b.SWAP_FROM_MINT
    where a.SWAP_FROM_MINT = b.SWAP_FROM_MINT
    and SWAP_TO_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
    and p_date >= '2022-01-01'
    and SWAP_TO_AMOUNT > 0 and a.SWAP_FROM_AMOUNT > 0
    group by 1,2 )
    ,
    raydium_usd as ( select swap_date, tx_id, swapper, swap_from_amount*price as amount_usd
    from raydium a left outer join sol_price b on swap_date = b.p_date
    where a.swap_from_mint = b.SWAP_FROM_MINT)
    ,
    raydium_data as ( select trunc(swap_date,'week') as date, count(DISTINCT(tx_id)) as tx,
    count(DISTINCT(swapper)) as user, sum(AMOUNT_USD) as volume,
    sum(volume) over (order by date asc) as cum_volume, sum(tx) over (order by date asc) as cum_tx,
    avg(amount_usd) as avg_volume
    from raydium_usd
    where date >= '2022-01-01'
    group by 1)

    select 'Uniswap' as platform, *
    from uniswap
    UNION
    select 'Raydium' as platform, *
    Run a query to Download Data