with maintable as (
select block_timestamp::date as date,
case when date >= '2022-11-08' then 'During and After FTX & Alameda Collapse'
else 'Before Collapse' end as timespan,
case when price_usd < 10 then 'Less Than $10'
when price_usd >= 10 and price_usd < 100 then '$10 - $100'
when price_usd >= 100 and price_usd < 1000 then '$100 - $1000'
else 'More Than $1000' end as volume_type,
count (distinct tx_hash) as TX_Count
from optimism.core.ez_nft_sales
where block_timestamp >= CURRENT_DATE - 30
group by 1,2,3)
select timespan,
volume_type,
avg (tx_count) as Average_TX_Count
from maintable
group by 1,2