with maintable as (
select block_timestamp::date as date,
case when date < '2022-11-08' then 'Before Collapse'
when date >= '2022-11-08' and date <= '2022-11-10' then 'Main Collapse Days'
when date > '2022-11-10' then 'After Collapse' end as timespan,
case when abs(amount0_usd) < 10 then 'Less Than $10'
when abs(amount0_usd) >= 10 and abs(amount0_usd) < 100 then '$10 - $100'
when abs(amount0_usd) >= 100 and abs(amount0_usd) < 1000 then '$100 - $1000'
when abs(amount0_usd) >= 1000 and abs(amount0_usd) < 10000 then '$1000 - $10000'
else 'More Than $10000' end as volume_type,
count (distinct tx_hash) as Swaps_Count
from ethereum.uniswapv3.ez_swaps
where block_timestamp >= '2022-10-25' and block_timestamp::date != CURRENT_DATE
group by 1,2,3)
select timespan,
volume_type,
avg (swaps_count) as Average_Swaps_Count
from maintable
group by 1,2