Skip to content

IntermediateOptions, Derivatives & FinancePython

Run this module

cd "Finance - Kelly Criterion"
python "kelly_criterion.py"

View source on GitHub


Kelly Criterion Position Sizing

The Kelly Criterion determines the optimal fraction of capital to allocate to maximize the long-run geometric growth rate of wealth.

Functions

Function Description
kelly_fraction(win_prob, win_loss_ratio) Discrete Kelly for binary bets
kelly_continuous(mu, sigma) Kelly for continuous return distributions
fractional_kelly(win_prob, ratio, fraction) Scaled-down Kelly for risk control
multi_asset_kelly(expected_returns, cov) Portfolio-level optimal allocation
kelly_growth_rate(win_prob, ratio, fraction) Expected log growth at given fraction

Key Concepts

  • Discrete Kelly: f* = p - q/b where p=win prob, q=1-p, b=win/loss ratio.
  • Continuous Kelly: f* = mu / sigma². Optimal leverage for log-normal returns.
  • Overbetting kills compounding: Full Kelly maximizes growth but has huge variance. Half-Kelly roughly preserves 75% of growth with half the variance.
  • Multi-asset: f* = Σ⁻¹μ. Accounts for correlations — a diversified Kelly portfolio.

Example

from kelly_criterion import kelly_fraction, fractional_kelly, kelly_growth_rate

# 60% win rate, 2:1 payoff
full_kelly = kelly_fraction(0.60, 2.0)   # 0.20 = 20% of capital
half_kelly = fractional_kelly(0.60, 2.0, 0.5)  # 0.10

# Growth rates
print(kelly_growth_rate(0.60, 2.0, 0.5))   # ~0.02 per bet
print(kelly_growth_rate(0.60, 2.0, 1.25))  # Lower! Overbetting hurts

Practical Notes

  • Full Kelly is theoretically optimal but practically dangerous (high variance, large drawdowns)
  • Half-Kelly is the most common real-world choice among professional gamblers and traders
  • Kelly assumes i.i.d. bets — serial correlation in returns changes the optimal fraction

Continue in Options, Derivatives & Finance

  • Advanced Options Pricing

    This module covers advanced mathematical techniques for pricing financial derivatives. The focus is on models beyond the standard assumptions. Rather than assuming constant volatility, we explore dynamic and local volatility models. These models are crucial for correctly valuing exotic options and managing the risks of complex derivatives portfolios.

  • Black-Scholes Option Pricing

    This module lets you price basic stock options (calls and puts) using the Black-Scholes formula, a foundation of modern financial analysis.

  • Bond Price and Yield

    This utility lets you calculate the fair price of a bond or estimate its yield to maturity (YTM), two of the most basic (and important!) ideas in investing.

  • CAPM

    CAPM is the idea that won a Nobel Prize and still anchors how the industry

  • Discounted Cash Flow (DCF)

    This tool calculates the present value of a series of future cash flows—the basic principle behind valuing businesses, real estate, projects, and stocks!

  • Dividend Tracker

    This utility does NOT use any external APIs. All data is managed locally for learning and experimentation.

Browse all modules Learning paths