lookback
🦉 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
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.
| Type | int |
| Default | 200 |
| Field | BotConfig.lookback |
| Consumed in | src/bot.py (AITradingBot.__init__, AITradingBot._load_dataset) |
What it does
Two distinct uses in src/bot.py:
-
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, solookbackis a hard upper bound on how far back any live computation can see. -
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 candleiand reaches back at mostlookbackcandles: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_loopcan 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_candlesmust be ≤lookback, or the warmup gate can never be satisfied.feature_windowis the rolling window used within this history;lookbackjust bounds how much history exists.regime_windowsimilarly reads the last N candles from this buffer.- Note: this
BotConfig.lookbackis unrelated to the standalone trainer’s--lookbackCLI flag, which configuresTrainerConfigfor 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.