RayyykETH merge swap 2
    Updated 2022-09-17
    with table_1 as (select date_trunc('day', block_timestamp) as day,
    platform,
    count(distinct(tx_hash)) as swap_count1,
    sum(amount_in) as eth_volume1
    from ethereum.core.ez_dex_swaps
    where symbol_in in ('WETH', 'ETH')
    and amount_in > 0
    and amount_in < 99999999
    and block_timestamp >= current_date - 60
    group by 1,2),

    table_2 as (select date_trunc('day', block_timestamp) as day,
    platform,
    count(distinct(tx_hash)) as swap_count2,
    sum(amount_out) as eth_volume2
    from ethereum.core.ez_dex_swaps
    where symbol_out in ('WETH', 'ETH')
    and amount_out > 0
    and amount_out < 99999999
    and block_timestamp >= current_date - 60
    group by 1,2)

    select a.day,
    case
    when a.day >= '2022-09-15 00:00:00.000' then 'Merged'
    when a.day >= '2022-09-08 00:00:00.000' and a.day < '2022-09-15 00:00:00.000' then 'One Week Before Merge'
    when a.day >= '2022-08-15 00:00:00.000' and a.day < '2022-09-08 00:00:00.000' then 'One Month Before Merge'
    else 'Two Months Before Merge'
    end as merge,
    ifnull(a.platform, b.platform) as platform,
    swap_count1 + swap_count2 as swap_count,
    eth_volume1 + eth_volume2 as eth_volume
    from table_1 a
    join table_2 b on a.day = b.day
    order by 1
    Run a query to Download Data