WITH GainOnePercent AS (
SELECT
COUNT(DISTINCT tx_id) AS gain_one_percent_swaps
from solana.swaps
where block_timestamp::date >= '2022-02-01'
and swap_program = 'jupiter aggregator v2'
and succeeded = 'True'
and (swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and (swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_to_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_from_amount >=100
and swap_to_amount >=100
AND (swap_to_amount-swap_from_amount)/swap_from_amount*100 >= 1),
AllSwaps AS(
select
COUNT(DISTINCT tx_id) AS all_swaps
from solana.swaps
where block_timestamp::date >= '2022-02-01'
and swap_program = 'jupiter aggregator v2'
and succeeded = 'True'
and (swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_from_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and (swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
or swap_to_mint = 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_from_amount >=100
and swap_to_amount >=100
)
SELECT
'Arbitrage',
G.gain_one_percent_swaps,
A.all_swaps
FROM GainOnePercent G, AllSwaps A