HosseinTotal copy
    Updated 2024-01-30
    with

    t2 as (
    select
    recorded_hour::date as date,
    token_address as mint,
    avg(close) as price_usd
    from solana.price.ez_token_prices_hourly
    group by 1, 2
    ),

    t3 as (
    select
    tx_hash,
    block_timestamp,
    amount_in_usd as amount_usd,
    origin_from_address as swapper,
    'uniswap on ethereum' as platform
    from ethereum.defi.ez_dex_swaps
    where platform ilike 'uniswap%'

    union

    select
    tx_id,
    block_timestamp,
    swap_from_amount * t2.price_usd as amount_usd,
    swapper,
    case
    when swap_program ilike 'raydium%' then 'raydium'
    when swap_program ilike 'orca%' then 'orca'
    when swap_program ilike 'jupiter%' then 'jupiter'
    when swap_program ilike 'Saber%' then 'saber'
    end as platform
    from solana.defi.fact_swaps
    join t2 on block_timestamp::date = t2.date and swap_from_mint = mint
    Last run: about 1 year ago
    PLATFORM
    SWAPS
    SWAPPERS
    VOLUME_USD
    AVG_VOLUME_USD
    MEDIAN_VOLUME_USD
    DAILY_AVERAGE_SWAPS
    DAILY_AVERAGE_SWAPPERS
    1
    uniswap on ethereum16279598787968101476693069908.4811791.4113255591045.52119527.1563886458.744493
    2
    jupiter156571519201218667177832110.3886428.72133615610.991884292201248.7390752586.357326
    3
    saber1766391399443126765250.991081770.1433323675.3050371142270.4254551.341902
    4
    raydium57075027145860214941047118.5152261.77574746726.19214515873361.2172241874.809769
    5
    orca31671509105926812841325420.2193405.45353933857.16422047740708.8804631361.526992
    5
    492B
    844s