MCPInstall

bet-sizing

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.

Installs
722
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/joellewis/finance_skills --skill bet-sizing
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads bet-sizing automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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

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

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.

FAQ

What does the bet-sizing skill do?

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.

How do I install bet-sizing?

Run npx skills add https://github.com/joellewis/finance_skills --skill bet-sizing in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/bet-sizing/ (personal) or .claude/skills/bet-sizing/ (project).

Which AI agents can use bet-sizing?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is bet-sizing safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains bet-sizing?

It is published by joellewis in joellewis/finance_skills. It has 722 recorded installs.

More from joellewis/finance_skills

View all →

asset-allocation

joellewis/finance_skills

Determine how to distribute capital across asset classes using strategic and tactical allocation frameworks. Use when the user asks about portfolio allocation, mean-variance optimization, Black-Litterman, risk parity, glide paths, or target-date strategies. Also trigger when users mention 'how much in stocks vs bonds', '60/40 portfolio', 'policy portfolio', 'core-satellite', 'liability-driven investing', 'asset-liability matching', or ask how to split their money across investments.

Business & Finance852 installs

statistics-fundamentals

joellewis/finance_skills

Apply statistical methods to financial data including descriptive statistics, covariance estimation, regression, hypothesis testing, and resampling. Use when the user asks about return distributions, correlation between assets, building a covariance matrix, running a CAPM regression, testing whether alpha is significant, checking if returns are normal, or estimating confidence intervals. Also trigger when users mention 'volatility', 'how correlated are these', 'fat tails', 'skewness', 'R-squared', 'beta of a fund', 'bootstrap a Sharpe ratio', 'shrinkage estimator', 'Ledoit-Wolf', or ask why their optimizer produces unstable weights.

Testing & QA817 installs

quantitative-valuation

joellewis/finance_skills

Estimate intrinsic value of stocks and companies using DCF, dividend discount models, comparable multiples, and residual income. Use when the user asks about discounted cash flow, DCF models, WACC, terminal value, dividend discount models, comparable multiples, or sum-of-the-parts valuation. Also trigger when users mention 'what is this stock worth', 'fair value estimate', 'Gordon growth model', 'free cash flow valuation', 'cost of equity', 'sensitivity analysis', 'exit multiple', or ask whether a stock is overvalued or undervalued.

Business & Finance787 installs

finance-psychology

joellewis/finance_skills

Recognize and mitigate cognitive biases that impair financial decisions, and coach clients toward values-driven financial lives. Use when the user asks about behavioral finance, money psychology, loss aversion, overconfidence, herd behavior, or emotional investing. Also trigger when users mention 'why do I panic sell', 'money fights with my spouse', 'I can never save enough', 'fear of investing', 'lifestyle creep', 'keeping up with the Joneses', 'Rich Life', 'money scripts', or ask how emotions affect financial decisions.

Business & Finance780 installs

commodities

joellewis/finance_skills

Analyze commodity markets including futures curve dynamics, roll yield, and supply/demand fundamentals. Use when the user asks about commodity investing, commodity ETFs, contango, backwardation, roll yield, commodity indices (GSCI, BCOM), or commodities as an inflation hedge. Also trigger when users mention 'oil prices', 'gold as a safe haven', 'agricultural futures', 'convenience yield', 'storage costs', 'natural gas', 'copper demand', or ask why commodity ETF returns differ from spot price changes.

Business & Finance774 installs

investment-policy

joellewis/finance_skills

Construct comprehensive Investment Policy Statements governing return objectives, risk tolerance, and portfolio constraints. Use when the user asks about building an IPS, setting return objectives, assessing risk tolerance, defining investment constraints, or establishing rebalancing and benchmark policies. Also trigger when users mention 'investment plan', 'policy portfolio', 'risk capacity vs willingness', 'spending rate for an endowment', 'foundation payout', 'manager selection criteria', or ask how to document their investment strategy.

Popular business & finance skills

View category →

sales-enablement

coreyhaines31/marketingskills

When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),

Business & Finance119.5K installs

revops

coreyhaines31/marketingskills

When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.

Business & Finance114.1K installs

sales-funnel-blueprint

autonnel/autonnel-skills

Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.

Business & Finance104.5K installs

pricing

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.

Business & Finance80K installs

cross-border-ecommerce

nexscope-ai/ecommerce-skills

Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.

Business & Finance62.9K installs

pricing-strategy

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.

Business & Finance61.2K installs