Calculate risk-based position sizes for long stock trades. Use when user asks about position sizing, how many shares to buy, risk per trade, Kelly criterion, ATR-based sizing, fractional-share sizing, or portfolio risk allocation. Supports stop-loss distance calculation, volatility scaling, and sector concentration checks.
70
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Calculate the optimal number of shares to buy for a long stock trade based on risk management principles. Supports three sizing methods:
All methods apply portfolio constraints (max position %, max sector %) and output a final recommended share count with full risk breakdown. The default output is whole shares. Use --fractional only when the user's broker supports fractional shares for the security and order type.
Collect from the user:
--fractional --share-precision N when supported by the brokerIf 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.
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/
# Fractional shares for small accounts or high-priced stocks
python3 skills/position-sizer/scripts/position_sizer.py \
--account-size 1000 \
--entry 155 \
--stop 148.50 \
--risk-pct 1.0 \
--fractional \
--share-precision 4 \
--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/Read references/sizing_methodologies.md to provide context on the chosen method, risk guidelines, and portfolio constraint best practices.
If the user has not specified a single method, run multiple scenarios for comparison:
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.
Present the final recommendation including:
{
"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
}Generated automatically alongside the JSON report. Contains:
Reports are saved to reports/ with filenames position_sizer_YYYY-MM-DD_HHMMSS.json and .md.
references/sizing_methodologies.md: Comprehensive guide to Fixed Fractional, ATR-based, and Kelly Criterion methods with examples, comparison table, and risk management principlesscripts/position_sizer.py: Main calculation script (CLI interface)62a1635
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.