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.
| Type | tuple of int (UTC hours, 0โ23) |
| Default | (0, 1, 2, 3, 4, 16, 17, 19, 20, 21, 22, 23) |
| Field | BotConfig.trading_hours |
| Consumed in | src/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 onlyfrom 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.