src.trading.performance
๐ฆ 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
Source: src/trading/performance.py. PerformanceTracker keeps session statistics in memory. It has no persistence of its own; on restart the bot repopulates wins/losses from the journal.
class PerformanceTracker
__init__(self)
No parameters. State: wins = losses = draws = 0, total_profit = 0.0 ($), consec_losses = 0, max_drawdown = 0.0 ($), _peak = 0.0 (running P&L high-water mark), and recent_results โ a deque(maxlen=100) of result strings.
Properties
totalโwins + losses + draws.win_rateโwins / (wins + losses); returns0.5when there are no decided trades (draws excluded from the denominator). This neutral prior matters:MoneyManager.compute_stake()uses it, and at 0.5 with a 0.85 payout the Kelly edge is negative, so an untested bot always betsbase_stake.
record(self, result: str, profit: float) -> None
| Parameter | Type | Meaning |
|---|---|---|
result | str | "win", "loss", or anything else (counted as a draw) |
profit | float | Signed $ amount added to total_profit |
Behavior: appends to recent_results; adds profit; "win" increments wins and resets consec_losses to 0; "loss" increments both losses and consec_losses; anything else increments draws (and leaves the streak untouched). Then updates drawdown: raises _peak if total_profit made a new high, and sets max_drawdown = max(max_drawdown, _peak โ total_profit).
consec_losses drives the botโs cooldown gate: when it reaches BotConfig.max_consec_losses (default 3), the trade loop enters a cooldown_seconds pause and resets the counter (see bot.md).
summary(self) -> str
One-line status used in trade logs and at shutdown, e.g.:
W:12 L:8 D:1 WR:60.0% P&L:$+83.50 MaxDD:$47.25 Streak:OK0
The streak part shows L<n> during a loss streak, OK0 otherwise.
Usage example
from src.trading.performance import PerformanceTracker
perf = PerformanceTracker()
perf.record("win", 21.25)
perf.record("loss", -25.0)
print(perf.win_rate) # 0.5
print(perf.summary())See also
- money-manager.md โ consumer of
win_rate - max_consec_losses, cooldown_seconds
๐ฌ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord โ or prototype strategies no-code with ChipaEditor.