docs(kb): source-84 — keeks bankroll-management (Kelly family) + sizing simulation - #127
Merged
Merged
Conversation
…sizing simulation Enrich the trading knowledge base with the `keeks` library (v0.3.0) and its 9-part "Bankroll Management with Keeks" series: the Kelly Criterion family of capital-allocation sizers. Adopted strictly as the mathematics of optimal capital allocation (halal framing — no betting/maysir; educational only). - source-84.md: disclaimer, per-strategy formulas (full/fractional/drawdown- adjusted Kelly, optimal f, Merton/CRRA, fixed fraction, CPPI, dynamic, naive), halal screen, keeks API reference, and educational commands. - README index: sources-log row 84 + a new module-map row for execution/sizing.py. - Verdict (like §83): CONFIRMS keel's risk model, does not reshape it. keel's fixed-fractional risk_pct=0.01 IS the Fixed Fraction strategy; full-Kelly at keel's own promotion floor (p .55 / R:R 1.5) is ~25%, so 1% ≈ 4% of Kelly — a 4th independent "use fractional f" confirmation, vindicated by §58.11. - Simulation (stdlib-only, 38 unit tests) measuring risk_pct vs the Kelly family on keel's floor edge, incl. an estimation-error stress run that defends staying sub-Kelly; report at reports/2026-07-22-bankroll-sizing-comparison.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…drift, ruff - README source-84 row: add the missing Source|Status column pipe (was a 3-cell row misaligned vs every other row). - simulate.py: format the estimation-error narrative figures from the results dict so the prose can't drift from the tables (5076x -> 5077x, matching source-84 §84.14 and proper rounding of 5076.555). - Wrap 5 long report-generation strings (E501) via implicit concatenation — report output byte-identical; ruff now clean. 38 tests still pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Enriches the trading knowledge base with the
keekslibrary (v0.3.0) and its 9-part "Bankroll Management with Keeks" series — the Kelly Criterion family of capital-allocation sizers.Halal framing: adopted strictly as the mathematics of optimal capital allocation, never betting (maysir). Educational only; nothing is wired into the live agent — the paper-proving gate + backtest floor still bind.
Contents
sources/source-84.md— disclaimer; per-strategy formulas (full / fractional / drawdown-adjusted Kelly, optimal f, Merton/CRRA, fixed fraction, CPPI, dynamic, naive); halal screen;keeksAPI reference; and educational commands to explore the rules & strategies.README.md— sources-log row 84 + a new module-map row forexecution/sizing.py.analysis/bankroll_sizing/— stdlib-only sizing formulas + Monte-Carlo (simulate.py) + 38 unit tests (all pass viauv run pytest).reports/2026-07-22-bankroll-sizing-comparison.md— the simulation write-up.Verdict (like §83: confirms the risk model, does not reshape it)
keel's fixed-fractional
risk_pct=0.01is the Fixed Fraction strategy. At keel's own promotion floor (win_rate 0.55, R:R 1.5), full-Kellyf* = (1.5·0.55−0.45)/1.5 = 0.25→ keel's 1% is ~4% of full Kelly — a 4th independent "use fractional f, never full" confirmation (§54.18/§83.5/§83.11). The simulation's estimation-error stress run (true p 5pts below estimate) collapses full-Kelly growth and lifts its ruin rate to 3.6% while the sub-Kelly levels stay at 0% ruin — defending keel's deeply-sub-Kelly posture, not a recommendation to changerisk_pct.Test plan
uv run pytest docs/superpowers/analysis/bankroll_sizing/test_sizing_strategies.py -q→ 38 passeduv run python docs/superpowers/analysis/bankroll_sizing/simulate.pyregenerates the report🤖 Generated with Claude Code