db_path

๐Ÿฆ‰ 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

Filesystem path of the SQLite database where every trade and periodic performance snapshot is recorded. The journal is also replayed at startup to retrain the models after a restart.

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

Typestr (file path)
Default"trade_journal.db" (relative to the working directory)
FieldBotConfig.db_path
Consumed insrc/bot.py (AITradingBot.__init__) โ†’ src/trading/journal.py (TradeJournal)

What it does

At construction the bot opens the journal: self.journal = TradeJournal(cfg.db_path). TradeJournal.__init__ (src/trading/journal.py) calls sqlite3.connect(db_path) โ€” SQLite creates the file if it does not exist (the parent directory must already exist) โ€” and ensures two tables:

  • trades โ€” one row per trade, keyed by trade id: direction, asset, stake ($), confidence, regime, entry/exit timestamps, result (win/loss/draw), profit ($), the JSON-encoded feature vector, and expiry (seconds). Rows are written with INSERT OR REPLACE when a trade is placed and again when it resolves. Older databases are migrated in place (missing features/expiry columns are added).
  • model_snapshots โ€” periodic snapshots (every 10 resolved trades): timestamp, win rate, total trades, daily P&L ($), regime.

The journal is central to persistence: on startup, if no saved brain is loaded, _reload_from_journal in src/bot.py loads all completed win/loss trades that have stored features (load_completed_trades), reconstructs training labels, retrains the ensemble with partial_fit(), restores the win/loss stats, and feeds the adaptive strategy. Deleting the file therefore wipes the botโ€™s trade memory (but not a saved brain file).

Valid values

Any writable file path; relative paths resolve against the directory you launch the bot from. Use one database per bot instance โ€” the journal opens a single SQLite connection without cross-process locking coordination.

Examples

# src/config.py
db_path: str = "data/eurusd_journal.db"   # the data/ directory must exist
from src.config import BotConfig
cfg = BotConfig(ssid="...", db_path="data/eurusd_journal.db")

Inspect the journal:

sqlite3 trade_journal.db "SELECT direction, result, profit FROM trades ORDER BY entry_time DESC LIMIT 10;"

Interactions

  • PO_BRAIN_PATH โ€” if a saved brain loads successfully, journal replay is skipped; the journal is the fallback learning source.
  • retrain_every governs live incremental fits; the journal replay does one fit over all loaded trades.
  • PO_RETRAIN deletes the brain and forces relearning from the journal (and dataset).

See also

๐Ÿ’ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ€” or prototype strategies no-code with ChipaEditor.