with bots as (
select date_trunc('minute', block_timestamp) as min, trader, count(*) as txs
from terra.swaps
where block_timestamp::date > current_date - 60
group by 1, 2
having txs > 10
),
bot_txs as (
select block_timestamp::date as date, count(*) as bot_tx
from terra.swaps
where date >= current_date - 60 and trader in (select distinct trader from bots)
group by 1
),
user_txs as (
select block_timestamp::date as date1, count(*) as user_tx
from terra.swaps
where date1 > current_date - 60 and trader not in (select distinct trader from bots)
group by 1
)
select date, bot_tx, user_tx
from bot_txs, user_txs
where date = date1