sepehrmhz8Untitled Query
    Updated 2022-09-24
    with in_ as (
    select date(block_timestamp) as date,
    count(distinct(tx_hash)) as swap_in,
    count(distinct(origin_from_address)) as users_1,
    sum(amount_in_usd) as usd_volume_in
    from ethereum.core.ez_dex_swaps
    where amount_in > 0
    and amount_in < 99999999
    and block_timestamp >= current_date - 64
    group by 1),

    out_ as (
    select date(block_timestamp) as date_1,
    count(distinct(tx_hash)) as swap_out,
    count(distinct(origin_from_address)) as users_2,
    sum(amount_out_usd) as usd_volume_out
    from ethereum.core.ez_dex_swaps
    where amount_out > 0
    and amount_out < 99999999
    and block_timestamp >= current_date - 64
    group by 1)

    select
    a.date,
    case when date >= '2022-07-22' and date < '2022-09-15' then 'Before Merge'
    when date >= '2022-09-15' then 'Post Merge' else null end as scheduling,
    swap_in + swap_out as swap_count,
    usd_volume_in + usd_volume_out as net_volume,
    users_1 + Users_2 as total_users
    from in_ a
    join out_ b on a.date = b.date_1
    order by 1
    Run a query to Download Data