RayyykBattle of DEXes 5
    Updated 2022-12-14
    with table_1 as (select date_trunc('day', block_timestamp) as day,
    'ETH Sold' as action,
    sum(amount_in_usd) as usd_volume,
    sum(usd_volume) over (partition by action order by day) as cumu_usd_volume
    from ethereum.core.ez_dex_swaps
    where block_timestamp >= '2022-11-01'
    and event_name = 'Swap'
    and platform ilike 'uniswap%'
    and symbol_in = 'WETH'
    group by 1
    union
    select date_trunc('day', block_timestamp) as day,
    'ETH Bought' as action,
    sum(amount_out_usd) as usd_volume,
    sum(usd_volume) over (partition by action order by day) as cumu_usd_volume
    from ethereum.core.ez_dex_swaps
    where block_timestamp >= '2022-11-01'
    and event_name = 'Swap'
    and platform ilike 'uniswap%'
    and symbol_out = 'WETH'
    group by 1)

    select *,
    case
    when day >= '2022-11-08 00:00:00.000' and day < '2022-11-11 00:00:00.000' then 'Collapse of FTX & Alameda'
    when day >= '2022-11-11 00:00:00.000' then 'After Collapsing'
    else 'Before Collapsing'
    end as event
    from table_1
    order by 1 desc
    Run a query to Download Data