lookback

🦉 AthenaAI is an AI-powered ensemble machine-learning trading bot for PocketOption, built on BinaryOptionsToolsV2Get it on GitLab
💬 Need help? Join the Chipa Discord · ⚡ Go no-code with ChipaEditor

Caps how much candle history the bot holds: it is both the maximum size of the live candle buffer and the per-sample history window during dataset pre-training.

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

Typeint
Default200
FieldBotConfig.lookback
Consumed insrc/bot.py (AITradingBot.__init__, AITradingBot._load_dataset)

What it does

Two distinct uses in src/bot.py:

  1. Live candle buffer size. The candle deque is created with this as its maximum length:

    self.candles: deque[Candle] = deque(maxlen=cfg.lookback)

    New candles from the stream push the oldest ones out. Everything downstream — feature extraction (FeatureEngine.compute), regime detection, and the 5-minute multi-timeframe trend check (which needs ≥100 candles) — operates on this buffer, so lookback is a hard upper bound on how far back any live computation can see.

  2. Per-sample history cap in dataset pre-training. When pre-training from a CSV (_load_dataset), each training sample’s features are computed on a chunk that ends at candle i and reaches back at most lookback candles:

    chunk = candles[max(0, i - self.cfg.lookback):i + 1]
    features = self.features_engine.compute(chunk, window)

    This keeps training-time feature computation consistent with what the live buffer can provide.

Valid values

Any positive integer, with practical constraints:

  • Must be at least 60 (the enforced warmup floor — see warmup_candles) and realistically ≥100 so the 5-minute trend confirmation in _trade_loop can activate.
  • Larger values give indicators more history at the cost of slightly more compute per loop iteration (features are recomputed on the whole buffer every poll).

Examples

# src/config.py
lookback: int = 300                     # keep 300 candles (5 h on 60s timeframe)
from src.config import BotConfig
cfg = BotConfig(ssid="...", lookback=300)

Interactions

  • warmup_candles must be ≤ lookback, or the warmup gate can never be satisfied.
  • feature_window is the rolling window used within this history; lookback just bounds how much history exists.
  • regime_window similarly reads the last N candles from this buffer.
  • Note: this BotConfig.lookback is unrelated to the standalone trainer’s --lookback CLI flag, which configures TrainerConfig for offline training.

See also

💬 Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord — or prototype strategies no-code with ChipaEditor.