RayyykPost Merge ETH Swap
    Updated 2022-09-25
    with table_1 as (select date_trunc('day', block_timestamp) as day,
    count(distinct(origin_from_address)) as selling_eth_wallet
    from ethereum.core.ez_dex_swaps
    where block_timestamp >= current_date - 60
    and symbol_in in ('WETH', 'ETH')
    group by 1),

    table_2 as (select date_trunc('day', block_timestamp) as day,
    count(distinct(origin_from_address)) as buying_eth_wallet
    from ethereum.core.ez_dex_swaps
    where block_timestamp >= current_date - 60
    or symbol_out in ('WETH', 'ETH')
    group by 1),

    table_3 as (select date_trunc('day', block_timestamp) as day,
    count(distinct(origin_from_address)) as wallet_count
    from ethereum.core.ez_dex_swaps
    where block_timestamp >= current_date - 60
    and (symbol_in in ('WETH', 'ETH')
    or symbol_out in ('WETH', 'ETH'))
    group by 1)

    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,
    selling_eth_wallet,
    buying_eth_wallet,
    selling_eth_wallet+buying_eth_wallet as total,
    wallet_count
    from table_1 a
    join table_2 b on a.day = b.day
    join table_3 c on a.day = c.day
    Run a query to Download Data