select
BLOCK_TIMESTAMP::date as date,
case
when BLOCK_TIMESTAMP < '2022-11-08' then 'Before FTX Collapse'
else 'After FTX Collapse'
end as status,
count(distinct TX_hash) as "# TXs",
count(distinct SENDER) as "# Swapper",
sum(AMOUNT_IN_USD) as "Swap Volume(USD)",
avg(AMOUNT_IN_USD) as "Avg Swap Volume(USD)"
from ethereum.core.ez_dex_swaps
where BLOCK_TIMESTAMP > '2022-10-01'
and AMOUNT_IN_USD is not NULL
and AMOUNT_IN_USD < 1000000000
and AMOUNT_IN_USD > 0
and BLOCK_TIMESTAMP < CURRENT_DATE
and EVENT_NAME = 'Swap'
group by 1,2
order by 1 desc