Sizing
The Whale.Sizing module computes optimal stake fractions. Every function
takes typed inputs (Probability, Odds, Edge) from Whale.Types and
returns a StakeFraction.
Kelly criterion
Section titled “Kelly criterion”The standard Kelly formula maximizes long-run geometric growth:
import Whale.Sizing exposing (kelly)import Whale.Types exposing (Probability, Odds)
let f = kelly (Probability.from_float 0.60) (Odds.decimal 2.00)-- f ≈ 0.20Fractional Kelly
Section titled “Fractional Kelly”Scales the full Kelly fraction by a fixed multiplier (commonly 0.25 to 0.5) to reduce variance at the cost of slower growth:
import Whale.Sizing exposing (fractional_kelly)
let f = fractional_kelly 0.5 (Probability.from_float 0.60) (Odds.decimal 2.00)-- f ≈ 0.10 (half Kelly)Capped Kelly
Section titled “Capped Kelly”Applies a hard ceiling to the computed fraction. Useful when bankroll constraints or policy rules impose a maximum per-bet exposure:
import Whale.Sizing exposing (capped_kelly)
let f = capped_kelly 0.05 (Probability.from_float 0.60) (Odds.decimal 2.00)-- f = 0.05 (clamped from 0.20)Risk-adjusted Kelly
Section titled “Risk-adjusted Kelly”Incorporates a risk aversion parameter that penalizes variance. Higher aversion values shrink the fraction more aggressively than fractional Kelly because the adjustment responds to the shape of the edge distribution:
import Whale.Sizing exposing (risk_adjusted_kelly)
let f = risk_adjusted_kelly { aversion = 2.0 } (Probability.from_float 0.55) (Odds.decimal 2.10)Correlation-aware simultaneous Kelly
Section titled “Correlation-aware simultaneous Kelly”Sizes a portfolio of simultaneous bets, accounting for pairwise correlation
between outcomes. Returns a vector of StakeFraction values, one per bet:
import Whale.Sizing exposing (simultaneous_kelly)import Whale.Types exposing (Probability, Odds)
let bets = [ { prob = Probability.from_float 0.55, odds = Odds.decimal 2.10 }, { prob = Probability.from_float 0.48, odds = Odds.decimal 3.00 },]
let correlation_matrix = [[1.0, 0.3], [0.3, 1.0]]
let fractions = simultaneous_kelly bets correlation_matrix-- fractions: vector of per-bet StakeFraction valuesWhen the correlation matrix is the identity, simultaneous Kelly reduces to independent Kelly applied to each bet. Positive correlation between outcomes shrinks the individual fractions to control aggregate exposure.