select
date_trunc('month', block_timestamp) as months,
sum(SWAP_FROM_AMOUNT) as total_swap_from,
sum(SWAP_TO_AMOUNT) as total_swap_to
from solana.core.fact_swaps
where BLOCK_ID in
(select
BLOCK_ID
from solana.core.fact_events
where PROGRAM_ID ='SWiMDJYFUGj6cPrQ6QYYYWZtvXQdRChSVAygDZDsCHC'--swim protocol
)
and SUCCEEDED='true'
group by 1