with protocol_list as ( select distinct protocol
from external.defillama.fact_dex_volume
where chain ilike 'optimism')
select date, protocol, sum(volume) as daily_volume
from external.defillama.fact_dex_volume
where chain ilike 'optimism'
and protocol in (select * from protocol_list)
group by 1,2