Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
tradermonty avatar

Position Sizer

  • 1k installs
  • 2.5k repo stars
  • Updated July 26, 2026
  • tradermonty/claude-trading-skills

position-sizer is a Claude Code skill that helps developers and traders calculate safe share quantities and risk amounts for stock trades using Fixed Fractional, ATR-based, and Kelly Criterion sizing methodologies.

About

position-sizer is a trading reference skill focused on the most critical factor for long-term portfolio survival: how many shares to buy on each trade. It documents three primary sizing methods—Fixed Fractional percentage risk popularized by Van Tharp, ATR-based volatility-adjusted sizing, and Kelly Criterion optimal fraction sizing—along with when each applies and how bad sizing can destroy returns even on good stock picks. Developers building trading tools, journaling workflows, or agent-assisted execution reach for position-sizer when they need deterministic formulas for risk dollars, stop distance, and share counts before submitting brokerage orders.

  • Implements three primary position sizing methods: Fixed Fractional, ATR-based, and Kelly Criterion
  • Includes standard risk percentage tables with trader profiles from 0.25% (institutional) to 2% (aggressive)
  • Provides exact formulas and worked examples for account-risk calculations
  • Prevents catastrophic drawdowns by enforcing disciplined capital allocation on every trade
  • Outputs ready-to-use share quantities and position values for live trading decisions

Position Sizer by the numbers

  • 1,007 all-time installs (skills.sh)
  • +51 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #138 of 1,136 Finance & Trading skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/tradermonty/claude-trading-skills --skill position-sizer

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1k
repo stars2.5k
Security audit3 / 3 scanners passed
Last updatedJuly 26, 2026
Repositorytradermonty/claude-trading-skills

How do you calculate position size for stock trades?

Calculate safe share quantities and risk amounts for every stock trade using proven professional methodologies.

Who is it for?

Developers building trading assistants or active equity traders who need repeatable position-size math tied to account risk and stop distance.

Skip if: Long-only passive index investors who never size individual entries or adjust per-trade risk.

When should I use this skill?

User mentions position sizing, share quantity, ATR stops, Kelly criterion, fixed fractional risk, or per-trade risk percentage.

What you get

Per-trade share counts, dollar risk amounts, and sizing-method worksheets using Fixed Fractional, ATR, or Kelly inputs.

By the numbers

  • Documents three primary position sizing methodologies

Files

SKILL.mdMarkdownGitHub ↗

Position Sizer

Overview

Calculate the optimal number of shares to buy for a long stock trade based on risk management principles. Supports three sizing methods:

  • Fixed Fractional: Risk a fixed percentage of account equity per trade (default: 1%)
  • ATR-Based: Use Average True Range to set volatility-adjusted stop distances
  • Kelly Criterion: Calculate mathematically optimal risk allocation from historical win/loss statistics

All methods apply portfolio constraints (max position %, max sector %) and output a final recommended share count with full risk breakdown.

When to Use

  • User asks "how many shares should I buy?"
  • User wants to calculate position size for a specific trade setup
  • User mentions risk per trade, stop-loss sizing, or portfolio allocation
  • User asks about Kelly Criterion or ATR-based position sizing
  • User wants to check if a position fits within portfolio concentration limits

Prerequisites

  • No API keys required
  • Python 3.9+ with standard library only

Workflow

Step 1: Gather Trade Parameters

Collect from the user:

  • Required: Account size (total equity)
  • Mode A (Fixed Fractional): Entry price, stop price, risk percentage (default 1%)
  • Mode B (ATR-Based): Entry price, ATR value, ATR multiplier (default 2.0x), risk percentage
  • Mode C (Kelly Criterion): Win rate, average win, average loss; optionally entry and stop for share calculation
  • Optional constraints: Max position % of account, max sector %, current sector exposure

If the user provides a stock ticker but not specific prices, use available tools to look up the current price and suggest entry/stop levels based on technical analysis.

Step 2: Execute Position Sizer Script

Run the position sizing calculation:

# Fixed Fractional (most common)
python3 skills/position-sizer/scripts/position_sizer.py \
  --account-size 100000 \
  --entry 155 \
  --stop 148.50 \
  --risk-pct 1.0 \
  --output-dir reports/

# ATR-Based
python3 skills/position-sizer/scripts/position_sizer.py \
  --account-size 100000 \
  --entry 155 \
  --atr 3.20 \
  --atr-multiplier 2.0 \
  --risk-pct 1.0 \
  --output-dir reports/

# Kelly Criterion (budget mode - no entry)
python3 skills/position-sizer/scripts/position_sizer.py \
  --account-size 100000 \
  --win-rate 0.55 \
  --avg-win 2.5 \
  --avg-loss 1.0 \
  --output-dir reports/

# Kelly Criterion (shares mode - with entry/stop)
python3 skills/position-sizer/scripts/position_sizer.py \
  --account-size 100000 \
  --entry 155 \
  --stop 148.50 \
  --win-rate 0.55 \
  --avg-win 2.5 \
  --avg-loss 1.0 \
  --output-dir reports/

Step 3: Load Methodology Reference

Read references/sizing_methodologies.md to provide context on the chosen method, risk guidelines, and portfolio constraint best practices.

Step 4: Calculate Multiple Scenarios

If the user has not specified a single method, run multiple scenarios for comparison:

  • Fixed Fractional at 0.5%, 1.0%, and 1.5% risk
  • ATR-based at 1.5x, 2.0x, and 3.0x multipliers
  • Present a comparison table showing shares, position value, and dollar risk for each

Step 5: Apply Portfolio Constraints and Determine Final Size

Add constraints if the user has portfolio context:

python3 skills/position-sizer/scripts/position_sizer.py \
  --account-size 100000 \
  --entry 155 \
  --stop 148.50 \
  --risk-pct 1.0 \
  --max-position-pct 10 \
  --max-sector-pct 30 \
  --current-sector-exposure 22 \
  --output-dir reports/

Explain which constraint is binding and why it limits the position.

Step 6: Generate Position Report

Present the final recommendation including:

  • Method used and rationale
  • Exact share count and position value
  • Dollar risk and percentage of account
  • Stop-loss price
  • Any binding constraints
  • Risk management reminders (portfolio heat, loss-cutting discipline)

Output Format

JSON Report

{
  "schema_version": "1.0",
  "mode": "shares",
  "parameters": {
    "entry_price": 155.0,
    "account_size": 100000,
    "stop_price": 148.50,
    "risk_pct": 1.0
  },
  "calculations": {
    "fixed_fractional": {
      "method": "fixed_fractional",
      "shares": 153,
      "risk_per_share": 6.50,
      "dollar_risk": 1000.0,
      "stop_price": 148.50
    },
    "atr_based": null,
    "kelly": null
  },
  "constraints_applied": [],
  "final_recommended_shares": 153,
  "final_position_value": 23715.0,
  "final_risk_dollars": 994.50,
  "final_risk_pct": 0.99,
  "binding_constraint": null
}

Markdown Report

Generated automatically alongside the JSON report. Contains:

  • Parameters summary
  • Calculation details for the active method
  • Constraints analysis (if any)
  • Final recommendation with shares, value, and risk

Reports are saved to reports/ with filenames position_sizer_YYYY-MM-DD_HHMMSS.json and .md.

Resources

  • references/sizing_methodologies.md: Comprehensive guide to Fixed Fractional, ATR-based, and Kelly Criterion methods with examples, comparison table, and risk management principles
  • scripts/position_sizer.py: Main calculation script (CLI interface)

Key Principles

1. Survival first: Position sizing is about surviving losing streaks, not maximizing winners 2. The 1% rule: Default to 1% risk per trade; never exceed 2% without exceptional reason 3. Round down: Always round shares down to whole numbers (never round up) 4. Strictest constraint wins: When multiple limits apply, the tightest one determines final size 5. Half Kelly: Never use full Kelly in practice; half Kelly captures 75% of growth with far less risk 6. Portfolio heat: Total open risk should not exceed 6-8% of account equity 7. Asymmetry of losses: A 50% loss requires a 100% gain to recover; size accordingly

Related skills

How it compares

Pick position-sizer for pre-trade share-count math rather than exchange connectivity or chart pattern analysis skills.

FAQ

Which position sizing methods does position-sizer include?

position-sizer covers Fixed Fractional percentage risk, ATR-based volatility sizing, and Kelly Criterion optimal fraction sizing. Each method translates account size, risk tolerance, and stop distance into a concrete share quantity for the next trade.

Why is position sizing important in position-sizer?

position-sizer treats sizing as the primary determinant of long-term portfolio survival because oversized entries can wipe out gains from otherwise solid stock selection. The skill helps standardize risk per trade before order entry across different market conditions.

Is Position Sizer safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Finance & Tradingfinancepricing

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.