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.

Typefloat
Default0.50
FieldBotConfig.kelly_fraction
Consumed insrc/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:

  1. If payout <= 0, return base_stake.
  2. Compute the edge: edge = win_rate * payout - (1 - win_rate). If edge <= 0, return base_stake β€” Kelly is only applied when the bot has a positive expected edge.
  3. Kelly fraction of bankroll: kelly = edge / payout.
  4. Scale by this field: fraction = kelly * kelly_fraction. With the default 0.50 this is β€œhalf Kelly”, a common way to reduce variance versus full Kelly.
  5. Interpolate between the stake bounds: stake = base_stake + fraction * (max_stake - base_stake).
  6. 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 at max_stake). The max(0.5, …) floor prevents low-confidence trades from being crushed to near-zero stakes.
  7. 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: stake starts at base_stake (the confidence multiplier can only reduce it, and the clamp restores base_stake), so every trade uses base_stake.
  • 0.25–0.5 β€” conservative fractional Kelly (default is 0.5).
  • 1.0 β€” full Kelly; stakes reach max_stake faster. Values above 1.0 over-bet relative to Kelly and are clamped at max_stake anyway.

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_STAKE and PO_MAX_STAKE define the range the Kelly interpolation moves within.
  • The win_rate input comes from the live PerformanceTracker (self.perf.win_rate in src/bot.py), so stakes adapt as results accumulate.
  • PO_MAX_DAILY_LOSS stops trading entirely after the daily loss limit, independent of stake sizing.
  • Confidence gating (PO_MIN_CONF, PO_MAX_CONF) bounds the confidence value 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.