PO_RETRAIN
๐ฆ 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
Force-retrain flag. When set to exactly 1, the bot deletes the saved brain file at startup and rebuilds its models from the trade journal and dataset.
| Type | flag (1 = on, anything else = off) |
| Default | (unset โ off) |
| Required | No |
| Maps to | (no BotConfig field) |
| Read in | src/bot.py (AITradingBot.start()) |
What it does
Unlike every other variable on this reference, PO_RETRAIN is not read in main.pyโs build_config() and has no BotConfig field. It is read directly inside AITradingBot.start() in src/bot.py:
force_retrain = os.environ.get("PO_RETRAIN", "").strip() == "1"
The value is whitespace-stripped and must be exactly "1". true, yes, on, etc. are all treated as off. Because main.py runs _load_dotenv() before starting the bot, a PO_RETRAIN=1 line in .env works too (unless a real environment variable already sets it to something else โ real env vars win).
When the flag is on:
- The bot logs
๐ Force retrain requested โ ignoring saved brain. - If the file at
PO_BRAIN_PATHexists, it is deleted withos.remove(). This is destructive and immediate โ back the file up first if you might want it back. The sibling*_expiry.pklstats file is not deleted, but it is not loaded either (loading only happens inside_load_brain(), which is skipped). _load_brain()is skipped, so the bot follows the fresh-start path: replay past trades from the SQLite journal (_reload_from_journal()), then pre-train fromPO_DATASETif set. The newly trained brain is saved back toPO_BRAIN_PATHwhen pre-training finishes.
When the flag is off (unset or any value other than 1), the bot tries to load the existing brain and only falls back to journal replay plus dataset training if loading fails.
The old *_expiry.pkl file will be loaded again on the next normal start (after the retrain run rewrites the brain), so expiry statistics effectively survive a forced retrain via the re-saved sibling file.
Valid values
| Value | Effect |
|---|---|
1 (exactly, after stripping whitespace) | Delete saved brain, retrain from journal + dataset |
| unset, empty, or anything else | Normal startup โ load saved brain if present |
Examples
Usually set for a single run rather than persisted:
PO_RETRAIN=1 python main.py$env:PO_RETRAIN = '1'; python main.py; Remove-Item Env:PO_RETRAIN# .env โ remember to remove this line afterwards,
# or every restart will delete the brain and retrain!
PO_RETRAIN=1
Leaving PO_RETRAIN=1 in .env permanently means every start deletes the brain and re-runs pre-training โ slow and it discards all live-trading learning that accumulated in the brain since the last journal write.
Interactions
- Deletes the file at
PO_BRAIN_PATH. - Retraining sources: the SQLite trade journal, then
PO_DATASETwith labels fromPO_DEFAULT_EXPIRY/PO_TIMEFRAME. - Real environment variables override
.env(see index) โ an exportedPO_RETRAIN=0masks a.envline setting it to1.
See also
๐ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ or prototype strategies no-code with ChipaEditor.