kelly_fraction
π¦ 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
Scales down the Kelly-criterion bet size to control how aggressively the bot sizes trades between base_stake and max_stake.
This field has no environment variable β to change it, edit the default in src/config.py or construct BotConfig yourself.
| Type | float |
| Default | 0.50 |
| Field | BotConfig.kelly_fraction |
| Consumed in | src/trading/money_manager.py (MoneyManager.compute_stake) |
What it does
MoneyManager.compute_stake(confidence, win_rate, payout=0.85) is called from the trade loop in src/bot.py just before a trade is placed (with payout=0.85). The full formula:
- If
payout <= 0, returnbase_stake. - Compute the edge:
edge = win_rate * payout - (1 - win_rate). Ifedge <= 0, returnbase_stakeβ Kelly is only applied when the bot has a positive expected edge. - Kelly fraction of bankroll:
kelly = edge / payout. - Scale by this field:
fraction = kelly * kelly_fraction. With the default0.50this is βhalf Kellyβ, a common way to reduce variance versus full Kelly. - Interpolate between the stake bounds:
stake = base_stake + fraction * (max_stake - base_stake). - Apply confidence scaling:
stake *= max(0.5, (confidence - 0.45) * 2.0). Examples: 60% confidence β 0.50Γ, 65% β 0.65Γ, 70% β 0.80Γ, 75% β 0.95Γ, and 95% β 1.0Γ (the multiplier exceeds 1.0 above 95% confidence, though the final clamp still caps the stake atmax_stake). Themax(0.5, β¦)floor prevents low-confidence trades from being crushed to near-zero stakes. - Clamp:
stake = max(base_stake, min(stake, max_stake)), rounded to 2 decimals ($).
So kelly_fraction controls how far above base_stake the stake climbs when the tracked win rate implies an edge. The final stake can never leave the [base_stake, max_stake] range (dollars).
Valid values
Any float. Sensible range is 0.0β1.0:
0.0β Kelly disabled in effect:stakestarts atbase_stake(the confidence multiplier can only reduce it, and the clamp restoresbase_stake), so every trade usesbase_stake.0.25β0.5β conservative fractional Kelly (default is0.5).1.0β full Kelly; stakes reachmax_stakefaster. Values above1.0over-bet relative to Kelly and are clamped atmax_stakeanyway.
Examples
Edit the default in src/config.py:
kelly_fraction: float = 0.25 # quarter Kelly, more conservative
Or construct the config in code:
from src.config import BotConfig
from src.bot import AITradingBot
cfg = BotConfig(ssid="...", kelly_fraction=0.25)
bot = AITradingBot(cfg)Interactions
PO_BASE_STAKEandPO_MAX_STAKEdefine the range the Kelly interpolation moves within.- The
win_rateinput comes from the livePerformanceTracker(self.perf.win_rateinsrc/bot.py), so stakes adapt as results accumulate. PO_MAX_DAILY_LOSSstops trading entirely after the daily loss limit, independent of stake sizing.- Confidence gating (
PO_MIN_CONF,PO_MAX_CONF) bounds theconfidencevalue that reaches the multiplier in step 6.
Risk note: binary options trading can lose money, and past performance does not guarantee future results. Raising kelly_fraction increases the dollar amount at risk per trade.
See also
π¬ Unsure how this interacts with the rest of the configuration? Ask in the Chipa Discord β or prototype strategies no-code with ChipaEditor.