select date_trunc('day', block_timestamp)::date as day,
iff(day >= '2022-11-08', 'After FTX Crisis', 'Before FTX Crisis') as type,
count (distinct (tx_hash)) as swaps_number,
count (distinct (recipient)) as swappers_number,
sum(iff(amount0_usd > 0, amount0_usd , -1 * amount0_usd)) as total_amount_usd,
avg(iff(amount0_usd > 0, amount0_usd , -1 * amount0_usd)) as average_amount_usd,
median(iff(amount0_usd > 0, amount0_usd , -1 * amount0_usd)) as median_amount_usd
from ethereum.uniswapv3.ez_swaps
where block_timestamp::date >= '2022-11-01'
group by day, type
order by day asc