Rayyyk Percentage of swaps were executed by bots in the past 30 days
    Updated 2022-04-23
    with table_1 as (select distinct(trader) as swapper,
    count(distinct(tx_id)) as swap_count
    from terra.swaps
    where block_timestamp >= current_date -30
    --tx_id = 'B635F9845C52975B5E86FB97B952056F3CF1B242987DA306F35D9A82B46C45BD'
    group by 1
    having swap_count >= 3000
    order by 2 desc),

    bots as (select sum(swap_count) as bots_swap_count
    from table_1),

    total as (select count(distinct(tx_id)) as total_swap_count
    from terra.swaps
    where block_timestamp >= current_date -30)

    select bots_swap_count,
    total_swap_count,
    (bots_swap_count/total_swap_count)*100 as bot_swap_percentage
    from bots, total

    /*select bots_swap_count, 'Bots Swap Count'
    from bots
    union
    select total_swap_count, 'Total Swap Count'
    from total*/
    Run a query to Download Data