trading_hours

๐Ÿฆ‰ AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2 โ†’ Get it on GitLab
๐Ÿ’ฌ Need help? Join the Chipa Discord ยท โšก Go no-code with ChipaEditor

A tuple of UTC hours (0โ€“23) during which trading is allowed. Outside these hours the trade loop skips every cycle. An empty tuple () disables the filter โ€” all hours allowed.

This field has no environment variable โ€” to change it, edit the default in src/config.py or construct BotConfig yourself.

Typetuple of int (UTC hours, 0โ€“23)
Default(0, 1, 2, 3, 4, 16, 17, 19, 20, 21, 22, 23)
FieldBotConfig.trading_hours
Consumed insrc/bot.py (AITradingBot._trade_loop, AITradingBot.start)

What it does

Every trade-loop iteration checks the current hour in UTC (not local time):

utc_hour_now = datetime.now(timezone.utc).hour
if self.cfg.trading_hours and utc_hour_now not in self.cfg.trading_hours:
    # diagnostic: "โธ Outside trading hours (14 UTC)"
    continue

Because the check is if self.cfg.trading_hours and โ€ฆ, an empty tuple is falsy and means no restriction โ€” the bot trades at any hour. Note that hour 18 UTC is absent from the default whitelist along with 05โ€“15.

The default was chosen from a 546-trade analysis (comment in src/config.py): the 08โ€“15 UTC block lost money consistently, so v6 restricts trading to the statistically profitable hours. The allowed hours are printed in the startup banner:

Confidence: 63%โ€“85% | Hours: 0,1,2,3,4,16,17,19,20,21,22,23 UTC

(or Hours: all UTC when the tuple is empty).

This static whitelist is complemented by the AdaptiveStrategy (src/trading/strategy.py), which additionally blocks any individual hour whose live win rate falls below 47% over at least 15 trades.

Valid values

Any tuple of integers 0โ€“23. Examples: () (all hours), (0, 1, 2, 3) (00:00โ€“03:59 UTC only). Values outside 0โ€“23 never match and silently block those โ€œhoursโ€. Remember to convert from your local timezone to UTC.

Examples

# src/config.py
trading_hours: tuple = ()                       # trade around the clock
# or
trading_hours: tuple = (16, 17, 19, 20, 21)     # evening UTC session only
from src.config import BotConfig
cfg = BotConfig(ssid="...", trading_hours=(16, 17, 19, 20, 21))

Interactions

  • Adaptive hour blocking (src/trading/strategy.py) can further restrict, never expand, this whitelist at runtime.
  • All other gates (min_wait_between_trades, confidence, cooldowns) still apply within allowed hours.

See also

๐Ÿ’ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ€” or prototype strategies no-code with ChipaEditor.