select date_trunc('day', block_timestamp) as date, action, case
when date between '2022-05-05' and '2022-05-12' then 'first spike'
when date between '2022-06-07' and '2022-06-18' then 'second spike' else 'others' end as type, sum(amount_usd) as volume, count(*) as number_of_swaps
from ethereum.sushi.ez_lending
where date >= '2022-01-01' and amount_usd is not null and lending_pool like '%km%'
group by 1, 2, 3