Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL
All skills

position-sizer

Calculate how many shares to buy for a long stock trade from your account size, entry, and stop.

When to use it

You have a trade setup with an entry and stop price but still need a share count that fits your risk budget.

For example

You say

Use position-sizer on a $100,000 account buying at $155 with a stop at $148.50, risking 1%, and cap the position at 10% of the account.

You get
  • Recommended share count
  • Dollar risk and percent
  • Binding constraint note

How it works

  • Compares fixed fractional, ATR-based, and Kelly sizing, and can run several risk levels side by side.
  • Whole shares by default; fractional shares only with the --fractional flag.
  • When several limits apply, the tightest one sets the final size.

Before installing

Requires Python 3.9+ with only the standard library; no API keys needed.

This skill includes 3 scripts your assistant may run on your computer.