Tony_IntelTop trading pairs
    Updated 2023-11-09
    with source as (
    select
    sum(case when amount_in_usd is not null then amount_in_usd else amount_out_usd end) as volume,
    count(distinct tx_hash) as tx_count,
    contract_address,
    pool_name,
    'arbitrum' as chain
    from
    arbitrum.defi.ez_dex_swaps
    where
    block_timestamp::date >= '2022-06-01' and
    amount_in_usd <= 15000000 and
    amount_out_usd <= 15000000 and
    platform ilike '%uniswap%'
    group by 3, 4, 5

    union all

    select
    sum(case when amount_in_usd is not null then amount_in_usd else amount_out_usd end) as volume,
    count(distinct tx_hash) as tx_count,
    contract_address,
    pool_name,
    'optimism' as chain
    from
    optimism.defi.ez_dex_swaps
    where
    block_timestamp::date >= '2022-06-01' and
    amount_in_usd <= 15000000 and
    amount_out_usd <= 15000000 and
    platform ilike '%uniswap%'
    group by 3, 4, 5

    union all

    select
    Run a query to Download Data