MasiBot Totals II
    Updated 2025-01-25
    with tb1 as (select BLOCK_TIMESTAMP,
    'Thorchain' as platform,
    tx_id as tx_hash,
    ifnull(from_address,NATIVE_TO_ADDRESS) as user,
    from_asset as symbol_in,
    to_asset as symbol_out ,
    blockchain,
    AFFILIATE_ADDRESS,
    case when FROM_AMOUNT_USD is null then TO_AMOUNT_USD else FROM_AMOUNT_USD end as volume
    from thorchain.defi.fact_swaps)
    ,
    tb2 as ( select user,
    trunc(block_timestamp,'minute') as minutes,
    count(DISTINCT tx_hash) as swaps
    from tb1
    group by 1,2
    having swaps >= 10)

    select
    count(DISTINCT user) as bots,
    count(DISTINCT tx_hash) as "Swaps",
    sum(volume) as "Volume USD",
    count(DISTINCT symbol_in) as "Traded Tokens"
    from tb1
    where block_timestamp::Date >= '2024-01-01' and block_timestamp::Date < '2025-01-01'
    and user in (select user from tb2)

    Last run: 6 days ago
    BOTS
    Swaps
    Volume USD
    Traded Tokens
    1
    66926419441377946368.3612100
    1
    35B
    10s