c2ctrader02 - Bots and success rate
    Updated 2022-04-28
    with bots_TX_SUC as(
    select date_trunc('hour',block_timestamp) time,TX_FROM trader,count(*) count
    from terra.transactions WHERE BLOCK_TIMESTAMP<=CURRENT_DATE-59 AND tx_status ilike 'SUCCEEDED'
    group by time,tx_from
    having count(*)>=120
    order by count desc
    ),
    --***************************************************************************
    bots_suc_in_min as (select time,sum(count) bots_tx_success from bots_tx_suc group by time),
    --***************************************************************************
    bots_TX_fail as (
    select date_trunc('hour',block_timestamp) time,TX_FROM trader,count(*) count
    from terra.transactions WHERE BLOCK_TIMESTAMP<=CURRENT_DATE-59 AND tx_status ilike 'failed'
    group by time,tx_from
    having count(*)>=120
    order by count desc
    ),
    --*******************************************************************************
    bots_fail_in_min as (select time,sum(count) bot_tx_failed from bots_tx_fail group by time),
    --*******************************************************************************
    users_TX_SUC as (
    select date_trunc('hour',block_timestamp) time,TX_FROM trader,count(*) count
    from terra.transactions WHERE BLOCK_TIMESTAMP<=CURRENT_DATE-59 AND tx_status ilike 'SUCCEEDED'
    group by time,TX_FROM
    having count(*)<120
    order by count desc
    ),
    --*********************************************
    users_suc_in_min as (select time,sum(count) user_tx_success from users_TX_SUC group by time),
    --*****************************************
    users_TX_fail as (
    select date_trunc('hour',block_timestamp) time,TX_FROM trader,count(*) count
    from terra.transactions WHERE BLOCK_TIMESTAMP<=CURRENT_DATE-59 AND tx_status ilike 'failed'
    group by time,TX_FROM
    having count(*)<120
    order by count desc
    Run a query to Download Data