zakkisyed#6 THORchain Arbitration ETH Bots
    Updated 2022-07-20
    with bots as (select
    from_address as eth_bot,
    block_timestamp::date as date,
    count(distinct tx_id) as number_of_txs
    from flipside_prod_db.thorchain.swaps
    where blockchain = 'ETH'
    -- and block_timestamp >='2022-01-01'
    group by 1,2
    having number_of_txs >= 50),

    swap_to_volume as (select from_address, sum(to_amount_usd) as to_volume
    from flipside_prod_db.thorchain.swaps
    where from_address in (select distinct eth_bot from bots)
    group by 1),

    swap_from_volume as (select from_address, sum(from_amount_usd) as from_volume
    from flipside_prod_db.thorchain.swaps
    where from_address in (select distinct eth_bot from bots)
    group by 1)

    select t.from_address, (to_volume - from_volume) as profit
    from swap_to_volume t
    join swap_from_volume f on t.from_address = f.from_address

    order by 2 desc

    Run a query to Download Data