with tab1 as (
select
date_trunc('day', block_timestamp),
from_address as arb_bot,
count(*)
from thorchain.swaps
where blockchain like 'ETH'
group by 1, 2
having count(*) > 50 )
select
date_trunc('day', block_timestamp),
sum(AMOUNT_OUT_USD) - sum(AMOUNT_IN_USD) as USD_Profit
from ethereum.core.ez_dex_swaps
where origin_from_address in (select arb_bot from tab1)
group by 1
having USD_Profit > 0