PO_BRAIN_PATH

🦉 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

Path of the pickle file holding the bot’s learned state — the model ensemble (“brain”). A sibling file holding per-expiry win/loss statistics is derived from the same path.

Typefile path
Defaultathena_brain.pkl
RequiredNo
Maps toBotConfig.brain_path
Read inmain.py (build_config())

What it does

build_config() reads it with env("PO_BRAIN_PATH", "athena_brain.pkl"). Note: BotConfig.brain_path itself defaults to athena_po_brain.pkl in src/config.py, but via main.py the effective default is athena_brain.pkl.

Consumed in src/bot.py:

Loading — at startup (unless PO_RETRAIN=1), _load_brain() calls ensemble.load_brain(cfg.brain_path). If it loads, journal replay and dataset pre-training are both skipped (✅ Loaded saved brain — skipping dataset training!). It also derives a sibling path by replacing .pkl with _expiry.pkl (e.g. athena_brain_expiry.pkl) and, if that file exists, restores the expiry selector’s learned win/loss stats.

Saving_save_brain() writes both files:

  • After dataset pre-training completes.
  • Automatically every 10 resolved trades (alongside a performance snapshot).
  • On shutdown via AITradingBot.stop() (including Ctrl-C, which main.py catches and turns into a stop() call).

Save failures are logged as warnings (Failed to save brain: …) but do not stop the bot.

Two practical caveats:

  • The _expiry.pkl sibling is derived with str.replace(".pkl", "_expiry.pkl") — if your brain path does not end in .pkl, the expiry-stats path equals the brain path and the two files overwrite each other. Always use a .pkl extension.
  • With PO_RETRAIN=1, the file at this path is deleted at startup.

Valid values

Any writable file path ending in .pkl. Relative paths resolve against the working directory. The directory must already exist — the bot loop does not create it.

Examples

export PO_BRAIN_PATH='state/athena_brain.pkl'
$env:PO_BRAIN_PATH = 'state\athena_brain.pkl'
# .env
PO_BRAIN_PATH=athena_brain.pkl

Interactions

  • PO_RETRAIN=1 deletes this file and forces retraining from PO_DATASET.
  • A brain trained on one asset/timeframe should not be reused for another — point different bot instances at different brain paths.
  • The trade journal database is separate (config-only db-path); it is replayed only when no brain loads.

See also

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