select
date_trunc('day', block_timestamp) as blocktime,
count(distinct tx_id) as number_of_swaps,
count_if(
substr(blockchain, 1, 3) != substr(pool_name, 1, 3)
and from_asset = 'THOR.RUNE'
) as exit_transactions
from
thorchain.swaps
where
blocktime > getdate() - interval '30 days'
group by
blocktime