Overview
ThePositionSizer class implements a fractional Kelly criterion strategy that dynamically adjusts position sizes based on model performance. The system uses Brier score tiers to map prediction accuracy to a fractional Kelly multiplier (alpha), ensuring conservative sizing during model uncertainty and more aggressive sizing when predictions are highly accurate.
Core Formula
The position sizer uses the fractional Kelly formula:p= predicted probability of the outcomeq= market implied probability (current price)α= fractional Kelly multiplier (alpha) from Brier tierbankroll= current account balance
Brier-Tiered Alpha Scaling
The system maps model accuracy to five distinct tiers, each with a specific alpha value:| Tier | Condition | Alpha | Description |
|---|---|---|---|
| Tier 0 | predictionCount < 100 | 0.00 | Insufficient data - no trading |
| Tier 1 | Brier > 0.26 | 0.10 | Low accuracy - minimal sizing |
| Tier 2 | 0.22 ≤ Brier ≤ 0.26 | 0.20 | Moderate accuracy |
| Tier 3 | 0.18 ≤ Brier < 0.22 | 0.25 | Good accuracy |
| Tier 4 | Brier < 0.18 | 0.40 | Excellent accuracy - maximum sizing |
The alpha values represent fractional Kelly multipliers. Even at Tier 4 (maximum aggression), the system only uses 40% of the full Kelly recommendation to reduce variance.
Implementation Details
getAlpha(brierScore, predictionCount)
Maps the current Brier score and prediction count to a fractional alpha:src/risk/position-sizer.js:28
calculateBet(params)
Computes the optimal bet size with the following logic:- Side determination: If
p ≥ 0.5, bet YES; otherwise bet NO - Probability inversion: For NO bets, invert both
pandqto compute the effective edge - Full Kelly calculation:
f* = (pEff - qEff) / (1 - qEff) - Edge check: If
f* ≤ 0, no edge exists → return zero bet - Alpha lookup: Retrieve alpha from Brier tier
- Drawdown adjustment: Multiply alpha by
alphaMultiplierif provided (see Drawdown Tracking) - Fractional sizing:
f_real = α × f* - Bet calculation:
bet = f_real × bankroll - Cap check: If
bet > maxBetPct × bankroll, cap at maximum - Floor check: If
bet < minBetUsd, return zero bet
src/risk/position-sizer.js:65
Return Values
ThecalculateBet method returns a detailed object:
Configuration Parameters
Position sizing behavior is controlled byconfig.risk:
Example Calculation
Given:p = 0.65(model predicts 65% probability)q = 0.52(market price is 52¢)bankroll = $10,000brierScore = 0.20(Tier 3 → α = 0.25)maxBetPct = 0.05- No drawdown adjustments
capped = true
Integration with Drawdown Tracker
The position sizer accepts optionaladjustments from the DrawdownTracker:
- Green zone:
alphaMultiplier = 1.0(no adjustment) - Yellow zone:
alphaMultiplier = 0.5(half sizing) - Red/Critical:
alphaMultiplier = 0(trading suspended)
Related
- Kelly Criterion - Theory and mathematical background
- Drawdown Tracking - Risk reduction during losses