Skip to content
SkillMixed1,935 tokens in use

Position Sizer

A standard-library Python calculator that turns account size, entry and stop into a risk-based share count using fixed fractional, ATR-based or Kelly sizing, with portfolio limits applied.

7,428 stars on the repository MIT Licensetradermonty/claude-trading-skills · skills/position-sizer

Skill label

measured from its files

What installing Position Sizer costs

63tokens idle
1,935tokens in use
5,217tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Mixed

Script-ledMixedModel-led

Scripts do part of the work and the model's judgement does the rest.

This describes the skill's structure, how much of it is scripts. It does not say how well it works. Scripts: scripts/position_sizer.py.

Touches

shelldetectedwrites filesdetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter12/15
  • Structure23/25
  • Examples12/15
  • Output10/15
  • Size15/15
  • Resources10/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent
  • Runs shell commands−5

    does this on the machine, and the frontmatter does not say so

    SKILL.md, line 53
  • Writes files−8

    does this on the machine, and the frontmatter does not say so

    scripts/position_sizer.py, line 536

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community68
  • Maturity36
  • Momentum40

Position Sizer calculates how many shares fit a defined risk budget for a long stock trade. It supports three methods: a fixed percentage of equity at risk, a stop distance derived from the Average True Range, and a Kelly criterion figure computed from win rate and average win and loss.

The script applies maximum position size and sector exposure limits, names the binding constraint, and writes JSON and Markdown reports. Whole shares are the default and fractional shares are an option. It needs no API key and no packages beyond the Python standard library.

What You Get

  • A final share count with position value, dollar risk and percentage of account at risk
  • A JSON report and a Markdown report named position_sizer_DATE_TIME
  • A comparison table across risk percentages or ATR multipliers
  • The name of the binding constraint when a position or sector limit applies
  • Fractional share results floored to a chosen precision when you ask for them

Common Use Cases

  • Working out how many shares to buy for a given entry and stop at one percent risk
  • Sizing from ATR so the stop distance follows volatility
  • Checking a Kelly budget from a measured win rate and win and loss sizes
  • Testing whether a new position breaches a sector concentration limit

What Makes It Unique

It stays small and predictable. The calculator uses only the standard library, floors share counts so the risk budget is never exceeded, and reports which constraint is the strictest. Its guidance recommends half Kelly, a one percent default risk and an overall portfolio heat limit, and it reminds small-account users that fractional shares leave broker minimums, spreads, fees and margin rules in place.

Under The Hood

Claude runs one Python script, position_sizer.py, from the shell with command-line arguments. The script does the arithmetic locally, calls no external service and needs no key. It writes a JSON and a Markdown report into the output folder, named with a timestamp. Claude reads a methodology reference file for context on the chosen method. If you give only a ticker, Claude may look up a price with whatever tools are available to suggest entry and stop levels.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers