feat: kellyParlay() — multi-leg parlay sizing#22
Conversation
Combines each leg's true win probability and American odds into a single effective bet (legs assumed independent), then runs the standard Kelly formula against the combined probability and odds. - returns fraction, combinedOdds, combinedDecimal, trueWinProb + KellyResult - matches single-leg kelly() for a one-leg parlay - zero fraction when no edge; throws on empty legs / out-of-range probability - README section + 5 new tests (143/143 passing) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f144646ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * ]); | ||
| * // → { fraction: ..., combinedOdds: ..., trueWinProb: 0.33, ... } | ||
| */ | ||
| export function kellyParlay( |
There was a problem hiding this comment.
Build kellyParlay into published dist artifacts
The package entry points resolve to dist/index.js and dist/index.d.ts via package.json, but this commit only adds kellyParlay under src/; rg kellyParlay dist/index.* has no matches in the checked-in build artifacts. Consumers importing @ianalloway/kelly-js from the published package will not have this advertised API at runtime or in TypeScript declarations, so the dist outputs need to be regenerated and committed with the source change.
Useful? React with 👍 / 👎.
Adds
kellyParlay()— sizes a multi-leg parlay (accumulator) as a single Kelly bet.What
Combines each leg's true win probability and American odds into one effective bet (legs assumed independent), then runs the standard Kelly formula against the combined probability and odds. Returns the usual
KellyResultpluscombinedOdds,combinedDecimal, andtrueWinProb.kelly()for a one-leg parlay.Tests
143/143 passing (
npm test).🤖 Generated with Claude Code