with all_tx as (
select block_timestamp::date as date, count(distinct tx_id) as tx_count
from solana.core.fact_swaps
where date >= '2022-01-01'
group by 1
order by 1 ASC
), success_tx as (
select block_timestamp::date as date, count(distinct tx_id) as tx_count
from solana.core.fact_swaps
where date >= '2022-01-01' and succeeded = 'TRUE'
group by 1
order by 1 ASC
)
select sum(all_tx.tx_count) as total_volume, sum(s_t.tx_count)/sum(all_tx.tx_count) * 100 as success_rate
from success_tx s_t join all_tx on s_t.date = all_tx.date