CryptoIcicleThor-112.Arbs, Arbs Everywhere! - # of Swaps, Swap Volume
    Updated 2022-07-20
    -- Payout 96.15 RUNE
    -- Grand Prize 288.46 RUNE
    -- Level Advanced

    -- Q.112 One of the core actors in the THORChain ecosystem are the “Traders” (https://docs.thorchain.org/roles/trading).
    -- These traders swap at a high frequency to make a profit and are a key cog to helping balance prices on THORChain
    -- We are taking a deep dive on these traders. To do so, you have 2 options:
    -- 1)Identify the Ethereum arb bots and show their activity over time. How many are there?
    -- What is their average swap frequency and volume?
    -- Which tokens are they swapping?
    -- Are they interacting with synths or non-synths?
    -- How much profit are they making?
    -- Hint: use thorchain.swaps and ethereum.core.ez_dex_swaps (to get the profit)
    -- Payouts will be on Thorchain

    with
    txns as (
    select
    block_timestamp::date as date,
    from_address as wallet,
    count(distinct tx_id) as n_txns
    from thorchain.swaps
    where block_timestamp >= CURRENT_DATE - {{n_days}}
    and blockchain = 'ETH'
    group by date, wallet
    ),
    wallets as (
    select
    wallet,
    avg(n_txns) as avg_n_txns,
    iff(avg_n_txns > {{threshold}}, 'bot', 'user') as type
    from txns
    group by wallet
    order by avg_n_txns desc
    )

    Run a query to Download Data