Skip to content

docs(kb): source-84 — keeks bankroll-management (Kelly family) + sizing simulation - #127

Merged
eaitbrahim merged 3 commits into
mainfrom
feat/kb-bankroll-management-keeks
Jul 23, 2026
Merged

docs(kb): source-84 — keeks bankroll-management (Kelly family) + sizing simulation#127
eaitbrahim merged 3 commits into
mainfrom
feat/kb-bankroll-management-keeks

Conversation

@eaitbrahim

Copy link
Copy Markdown
Contributor

What

Enriches 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.

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; keeks API reference; and educational commands to explore the rules & strategies.
  • README.md — sources-log row 84 + a new module-map row for execution/sizing.py.
  • analysis/bankroll_sizing/ — stdlib-only sizing formulas + Monte-Carlo (simulate.py) + 38 unit tests (all pass via uv 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.01 is the Fixed Fraction strategy. At keel's own promotion floor (win_rate 0.55, R:R 1.5), full-Kelly f* = (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 change risk_pct.

Test plan

  • uv run pytest docs/superpowers/analysis/bankroll_sizing/test_sizing_strategies.py -q → 38 passed
  • uv run python docs/superpowers/analysis/bankroll_sizing/simulate.py regenerates the report

🤖 Generated with Claude Code

eaitbrahim and others added 3 commits July 22, 2026 20:24
…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>
@eaitbrahim
eaitbrahim merged commit 9d44944 into main Jul 23, 2026
@eaitbrahim
eaitbrahim deleted the feat/kb-bankroll-management-keeks branch July 23, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant