Agent skill

Bet Sizing

by JoelLewis in JoelLewis/finance_skills

Determine how much capital to allocate to individual positions within a portfolio.

MITAuto-check passedBusiness, Finance & HR

Install Bet Sizing

skills CLI
$ npx skills add JoelLewis/finance_skills --skill bet-sizing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install JoelLewis/finance_skills bet-sizing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/JoelLewis/finance_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/wealth-management/skills/bet-sizing .claude/skills/bet-sizing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bet-sizing
GitHub stars
206
Token cost
~2.5k tokens
SKILL.md length
1,222 words
Files
2 (incl. scripts)
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Determine how much capital to allocate to individual positions within a portfolio.

  • The user asks about position sizing
  • SKILL.md covers Core Concepts, Key Formulas, Worked Examples and Common Pitfalls, plus 2 more sections
  • Runs Python scripts from its folder; calls uv, python3 and python
  • The Kelly criterion

What it does

Bet Sizing is an agent skill from JoelLewis/finance_skills. Determine how much capital to allocate to individual positions within a portfolio. Use when the user asks about position sizing, the Kelly criterion, fractional Kelly, risk budgeting, or conviction weighting. Also trigger when users mention 'how much to put in one stock', 'maximum position size', 'how concentrated should my portfolio be', 'number of holdings', 'VaR budget per position', 'how big a bet', or ask about scaling position sizes with volatility.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including scripts (for example `scripts/bet_sizing.py`).

It sits in Business, Finance & HR, covering Budgeting and forecasting. The repository describes itself as: Claude Code skill plugins for financial services — 81 skills across 7 domain plugins covering investment management, compliance, advisory practice, trading, and operations. The licence is MIT.

When your agent uses it

  • The user asks about position sizing
  • The Kelly criterion
  • Fractional Kelly
  • Conviction weighting

Example prompts

  • “how much to put in one stock”
  • “maximum position size”
  • “how concentrated should my portfolio be”
  • “/bet-sizing”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 5c498ea. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • uv
    • python3
    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bet Sizing loads about 2.5k tokens when it runs. Until then it costs about 118 tokens; SKILL.md has 1,222 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~118
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from JoelLewis/finance_skills at commit 5c498ea, republished under its MIT licence (© JoelLewis). 1,222 words, ~2,455 tokens.

Download SKILL.mdSave it as .claude/skills/bet-sizing/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
bet-sizing
description
Determine how much capital to allocate to individual positions within a portfolio. Use when the user asks about position sizing, the Kelly criterion, fractional Kelly, risk budgeting, or conviction weighting. Also trigger when users mention 'how much to put in one stock', 'maximum position size', 'how concentrated should my portfolio be', 'number of holdings', 'VaR budget per position', 'how big a bet', or ask about scaling position sizes with volatility.

Bet Sizing

Core Concepts

Kelly Criterion (Discrete)

For a binary bet with payoff odds b, win probability p, and loss probability q = 1-p:

f* = (b*p - q) / b

where f* is the optimal fraction of wealth to wager. The Kelly criterion maximizes the expected logarithm of wealth (geometric growth rate) over repeated bets.

Properties:

  • f* = 0 when edge = 0 (no bet when there is no advantage)
  • f* < 0 when negative edge (the formula tells you to bet the other side)
  • f* > 0 only when b*p > q (positive expected value)

Note: the reference script's discrete_kelly clamps negative Kelly fractions to 0 (no bet) rather than returning a negative value — it does not recommend taking the other side.

Kelly Criterion (Continuous / Investment)

For a normally distributed investment return with expected excess return mu-r_f and variance sigma^2:

f* = (mu - r_f) / sigma^2

This gives the fraction of total wealth to allocate. For example, an asset with 8% expected excess return and 20% volatility: f* = 0.08 / 0.04 = 2.0 (200% of wealth — implying leverage).

Fractional Kelly

Full Kelly sizing is theoretically optimal but practically too aggressive because:

  • It assumes perfect knowledge of probabilities and payoffs
  • It produces large drawdowns (the expected drawdown of full Kelly is significant)
  • Estimation error in parameters can turn optimal into catastrophic

Practical approach: use a fraction of Kelly, commonly:

  • Half Kelly (f/2):* Achieves 75% of the growth rate with substantially lower variance and drawdown risk
  • Third Kelly (f/3):* Even more conservative; appropriate when parameter uncertainty is high
  • Quarter Kelly (f/4):* Suitable for highly uncertain estimates

The key insight: the growth rate curve is flat near the peak. Reducing from full Kelly to half Kelly only sacrifices 25% of growth but reduces risk dramatically.

Risk Budgeting

Allocate risk (not capital) across positions. The total risk budget is the maximum acceptable portfolio risk (e.g., 10% VaR or 5% tracking error).

VaR-based budgeting:

  • Total VaR budget: e.g., $1M at 95% confidence
  • Allocate across positions: Position VaR_i <= allocated VaR_i
  • Position VaR = w_i * sigma_i * z_alpha * Portfolio Value

Tracking error budgeting (for active managers):

  • Total active risk budget: e.g., 4% tracking error
  • Allocate across bets: each active bet consumes a portion of tracking error
  • Size active positions so that sum of risk contributions equals total risk budget
Maximum Position Sizes

Hard limits on individual positions to prevent concentration risk:

Liquidity-based limits:

  • Position < X% of average daily volume (ADV) — common limits: 10-25% of ADV
  • Ensures ability to exit within a reasonable time frame (e.g., 5-10 trading days)

Risk-based limits:

  • Position risk contribution < X% of portfolio volatility (e.g., max 10% of portfolio risk)
  • Single position < X% of portfolio value (common: 5% for diversified, 10% for concentrated)

Regulatory/mandate limits:

  • Mutual fund: no more than 5% in a single name (diversified fund) or 25% (non-diversified)
  • Index tracking: weight cannot deviate from benchmark by more than specified amount
Conviction Weighting

Size positions proportional to the strength of the investment thesis:

  • High conviction (largest positions): Strong edge, deep research, multiple confirming factors
  • Medium conviction: Solid thesis but some uncertainty or limited information
  • Low conviction (smallest positions): Early-stage idea, limited edge, or purely diversification-motivated

Framework: Score each position on edge strength (1-5) and certainty (1-5). Size proportional to the product: edge * certainty.

Optimal Number of Positions

Trade-off between diversification and conviction:

  • Concentrated (10-20 positions): High conviction, deep research. Each position is 5-10% of the portfolio. Appropriate when the manager has genuine skill and edge.
  • Diversified (50-100 positions): Lower conviction per position but broader risk reduction. Each position is 1-3%. Appropriate for systematic or factor-based strategies.
  • Very diversified (100+): Index-like. Risk comes from factor tilts, not individual positions.
Volatility Scaling

Adjust position sizes inversely with volatility to maintain consistent risk per position:

Adjusted size = Target risk / Current volatility

When volatility doubles, position size halves, keeping the dollar risk constant. This is a core principle in managed futures and risk-targeting strategies.

Anti-Martingale (Kelly-like) Sizing

Increase position sizes after gains (wealth grows, so Kelly fraction applied to larger base) and decrease after losses. This contrasts with martingale strategies (doubling down after losses) which can lead to ruin.

Kelly naturally implements anti-martingale sizing: bet a constant fraction of current wealth, so absolute bet size grows with wealth and shrinks with losses.

Key Formulas

FormulaExpressionUse Case
Kelly (Discrete)f* = (b*p - q) / bBinary bet sizing
Kelly (Continuous)f* = (mu - r_f) / sigma^2Investment position sizing
Half Kellyf = f* / 2Practical conservative sizing
Growth Rate at Kellyg* = (mu - r_f)^2 / (2*sigma^2)Maximum geometric growth
Growth Rate at fg(f) = f*(mu - r_f) - f^2*sigma^2/2Growth rate for any fraction
Volatility-Scaled Sizew = target_risk / sigma_iConstant risk per position
Position VaRVaR_i = w_i * sigma_i * z_alpha * VPosition-level risk
Show full SKILL.md (456 more words)Show less

Worked Examples

Example 1: Kelly Criterion for a Discrete Bet

Given:

  • Win probability: p = 55%
  • Loss probability: q = 45%
  • Even-money payoff: b = 1 (win $1 for every $1 wagered)

Calculate: Optimal bet size

Solution:

f* = (b*p - q) / b = (1 * 0.55 - 0.45) / 1 = 0.10 / 1 = 10%

Interpretation: Wager 10% of current wealth on each bet. This maximizes long-run geometric growth.

Practical adjustment (half Kelly): f = 10% / 2 = 5% — achieves 75% of the maximum growth rate with much lower drawdown risk.

Full Kelly expected drawdown: the probability of losing 50% of wealth at some point is substantial. Half Kelly dramatically reduces this tail risk.

Example 2: Continuous Kelly for an Investment

Given:

  • Expected excess return (mu - r_f): 8%
  • Volatility (sigma): 20%

Calculate: Kelly-optimal allocation

Solution:

f* = (mu - r_f) / sigma^2 = 0.08 / (0.20)^2 = 0.08 / 0.04 = 2.00 (200%)

This implies 200% allocation (2x leverage), which is extremely aggressive.

Practical adjustments:

  • Half Kelly: 100% (no leverage, fully invested)
  • Third Kelly: 67% allocation
  • Quarter Kelly: 50% allocation

Given that the 8% expected return and 20% volatility are estimates with significant uncertainty, half Kelly (100%) or less is prudent. The growth rate curve is:

  • Full Kelly: g* = 0.08^2 / (2 * 0.04) = 8% per year
  • Half Kelly: g(1.0) = 1.0 * 0.08 - 1.0^2 * 0.04/2 = 6% per year (75% of maximum)
  • Quarter Kelly: g(0.5) = 0.5 * 0.08 - 0.5^2 * 0.04/2 = 3.5% per year (44% of maximum)

Common Pitfalls

  • Full Kelly is too aggressive for practical use — estimation errors in probabilities and payoffs can lead to over-betting and ruin; always use fractional Kelly
  • Kelly assumes known probabilities and payoffs — in reality these are estimated with significant error, making full Kelly dangerous
  • Kelly maximizes log wealth (geometric growth rate), which may not match an investor's actual utility function or risk tolerance
  • Ignoring liquidity constraints: Kelly-optimal size may exceed what the market can absorb without impact
  • Correlation between positions: the single-asset Kelly formula does not account for portfolio effects; positions with correlated risk collectively require smaller sizing
  • Survivorship bias in parameter estimation: historical win rates may overstate future edge
  • Not adjusting for regime changes: edge and volatility are time-varying

Cross-References

  • historical-risk (wealth-management plugin): realized volatility as a key input to Kelly sizing
  • forward-risk (wealth-management plugin): expected return forecasts as inputs to Kelly criterion
  • diversification (wealth-management plugin): tension between concentration (large bets) and diversification (many small bets)
  • asset-allocation (wealth-management plugin): bet sizing operates within the asset allocation framework
  • rebalancing (wealth-management plugin): positions drift from target sizes and require rebalancing
  • quantitative-valuation (wealth-management plugin): valuation-based edge estimates feed into conviction weighting

Running the Script

bash
uv run scripts/bet_sizing.py            # run the demo (uses PEP 723 inline deps)
uv run scripts/bet_sizing.py --verify   # check demo outputs against the worked examples (exit 1 on mismatch)
python3 scripts/bet_sizing.py            # alternative (requires: pip install numpy)

The demo prints the calculations covered above; its values match the worked examples in this skill. Run --help for a list of the classes and functions. For programmatic use, import the module rather than running it — the demo only executes under python bet_sizing.py.

© JoelLewis, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in plugins/wealth-management/skills/bet-sizing of JoelLewis/finance_skills.

  • SKILL.md
  • scripts/bet_sizing.py

Open the folder on GitHubat commit 5c498ea

Compare with similar skills

Bet Sizing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bet Sizing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bet Sizing this skillJoelLewis/finance_skills206—~2.5kAutomated safety check: PassMIT
Longbridge Researchhelsome/folio2713 repos~2.1kAutomated safety check: PassMIT
Cre Asset Managementahacker-1/cre-agent-skills113—~1.8kAutomated safety check: PassApache-2.0
Dd LogsDataDog/pup1k—~1.3kAutomated safety check: PassApache-2.0
Cash Flow ForecastWellApp-ai/Well345—~567Automated safety check: PassMIT
Cash Flow Snapshotsandbaseai/sandbase-skills203—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Longbridge Research

    helsome/folio

    Institution ratings, consensus price targets, EPS/revenue forecasts, finance calendar, shareholder data, fund holders, insider trades (SEC Form 4), short interest, industry rankings, peer group…

    271 GitHub starsUsed in 3 repos~2.1k tokens
    Business, Finance & HRAuto-check passed
  • Cre Asset Management

    ahacker-1/cre-agent-skills

    CRE Asset Management analysis suite — 9 specialist skills for post-acquisition multifamily operations including annual budgeting, monthly variance analysis, rent collection, renewal decisions…

    113 GitHub stars~1.8k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Dd Logs

    DataDog/pup

    Official

    Log management - search, pipelines, archives, and cost control.

    1k GitHub stars~1.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Cash Flow Forecast

    WellApp-ai/Well

    Forecast cash flow and runway for a Well workspace from booked invoices and collected bank transactions.

    345 GitHub stars~567 tokensUpdated 3 days ago
    Business, Finance & HRAuto-check passed
  • Cash Flow Snapshot

    sandbaseai/sandbase-skills

    Create a 30/60/90-day cash-flow forecast from AR, AP, opening cash, payment timing, and fixed-cost data.

    203 GitHub stars~1.9k tokensUpdated 14 days ago
    Business, Finance & HRAuto-check passed
  • Budget Cash Flow

    sickn33/agentic-awesome-skills

    Budget against actual by department, category and period, with budget and actual amounts, variance, percentage used and linked expenses.

    47k GitHub starsUsed in 1 repo~4.1k tokens
    Business, Finance & HRAuto-check passed

More from JoelLewis/finance_skills

All 91 skills in this repo
  • Asset Allocation

    JoelLewis/finance_skills

    Determine how to distribute capital across asset classes using strategic and tactical allocation frameworks.

    206 GitHub stars~2.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Commodities

    JoelLewis/finance_skills

    Analyze commodity markets including futures curve dynamics, roll yield, and supply/demand fundamentals.

    206 GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Currencies And Fx

    JoelLewis/finance_skills

    Analyze currency markets, exchange rate mechanics, and FX risk management for international portfolios.

    206 GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Debt Management

    JoelLewis/finance_skills

    Provide frameworks for managing and paying off personal debt effectively.

    206 GitHub stars~2.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Diversification

    JoelLewis/finance_skills

    Build diversified portfolios using correlation analysis, efficient frontier construction, and factor-based diversification.

    206 GitHub stars~2.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Emergency Fund

    JoelLewis/finance_skills

    Size and structure an emergency fund based on individual circumstances, income stability, and expense profile.

    206 GitHub stars~2.7k tokensUpdated 2 mo ago
    Auto-check passed

Questions about Bet Sizing

What does Bet Sizing do?

Determine how much capital to allocate to individual positions within a portfolio. Bet Sizing is an agent skill from JoelLewis/finance_skills. Determine how much capital to allocate to individual positions within a portfolio.

When should I use Bet Sizing?

Bet Sizing fits situations like: the user asks about position sizing; the Kelly criterion; fractional Kelly; conviction weighting.

How do I install Bet Sizing in Claude Code?

Run `npx skills add JoelLewis/finance_skills --skill bet-sizing -a claude-code`. Or copy the skill folder (plugins/wealth-management/skills/bet-sizing in JoelLewis/finance_skills) into .claude/skills/bet-sizing in your project. Claude Code loads it when a task matches its description.

How do I install Bet Sizing in Codex?

Run `npx skills add JoelLewis/finance_skills --skill bet-sizing -a codex`. Or copy the skill folder (plugins/wealth-management/skills/bet-sizing in JoelLewis/finance_skills) into .agents/skills/bet-sizing in your project. Codex loads it when a task matches its description.

Can I use Bet Sizing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add JoelLewis/finance_skills --skill bet-sizing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bet-sizing, .gemini/skills/bet-sizing, .github/skills/bet-sizing and .opencode/skills/bet-sizing in your project.

What does Bet Sizing need to run?

Going by SKILL.md and its folder, Bet Sizing needs Python for the scripts in its folder and the command-line tools its instructions call (uv, python3 and python). Our summary lists: Python 3.

Does Bet Sizing access the network?

SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Bet Sizing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Bet Sizing use?

Bet Sizing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bet Sizing use?

About 2.5k tokens (SKILL.md is roughly 9.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bet Sizing?

Skills that share tags, products or a category with Bet Sizing: Longbridge Research (helsome/folio, 271 stars), Cre Asset Management (ahacker-1/cre-agent-skills, 113 stars), Dd Logs (DataDog/pup, 1k stars) and Cash Flow Forecast (WellApp-ai/Well, 345 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bet Sizing?

JoelLewis (a GitHub user) maintains it in JoelLewis/finance_skills, which has 206 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on July 18, 2026.

Source: JoelLewis/finance_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.