agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when deciding how large a position to take. Covers fixed-fractional risk, volatility-based sizing, the Kelly criterion and why to fractionalize it, and portfolio concentration limits.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill position-sizing --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/position-sizingContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when deciding how large a position to take. Covers fixed-fractional risk, volatility-based sizing, the Kelly criterion and why to fractionalize it, and portfolio concentration limits.
name: position-sizing description: Use when deciding how large a position to take. Covers fixed-fractional risk, volatility-based sizing, the Kelly criterion and why to fractionalize it, and portfolio concentration limits. metadata: category: finance version: 1.0.0 tags: [position-sizing, risk, kelly, volatility, portfolio]
Determine how much to risk on a single position, so that a losing streak is survivable and no single idea can end the account. Position sizing determines survival; entry selection determines returns. Survival comes first.
1. **Fix the risk per trade first** — Typically 0.5% to 2% of equity. This is a policy decision made when calm, not a per-trade judgment made when excited. 2. **Determine the stop** — At a level where the thesis is wrong, not at a level that produces a comfortable size. This is the discipline that everything else depends on. 3. **Size from the stop distance** — Shares = (equity × risk%) / (entry − stop). A wider stop means a smaller position, not more risk. 4. **Check the concentration limits** — Position size as a percentage of equity, sector exposure, and correlated exposure. A limit breached is a size reduced. 5. **Check the aggregate** — Ten positions each risking 1% is 10% at risk if they are correlated and all stop out together. In a market-wide selloff, they will be.
**Fixed-fractional sizing — the calculation that matters:**
def position_size(
equity: float,
entry: float,
stop: float,
risk_pct: float = 0.01,
max_position_pct: float = 0.20,
) -> PositionSize:
if stop >= entry:
raise ValueError("stop must be below entry for a long position")
risk_dollars = equity * risk_pct
risk_per_share = entry - stop
shares = int(risk_dollars / risk_per_share)
# The concentration limit binds independently of the risk limit. A very tight
# stop can otherwise produce a position worth more than the account.
max_shares_by_concentration = int((equity * max_position_pct) / entry)
limited = shares > max_shares_by_concentration
final = min(shares, max_shares_by_concentration)
return PositionSize(
shares=final,
position_value=final * entry,
dollar_risk=final * risk_per_share,
pct_of_equity=(final * entry) / equity,
limited_by_concentration=limited,
)
# equity 100,000 | entry 50.00 | stop 47.50 | risk 1%
# risk_dollars = 1,000
# risk_per_share = 2.50
# shares = 400 -> position value 20,000 (20% of equity)
# At the concentration cap exactly. A tighter stop of 49.50 would compute
# 2,000 shares ($100,000 — the whole account), and the cap correctly binds.**Kelly, and why it is fractionalized:**
def kelly_fraction(win_rate: float, avg_win: float, avg_loss: float) -> float:
"""f* = p - q/b, where b is the win/loss ratio."""
b = avg_win / abs(avg_loss)
f = win_rate - (1 - win_rate) / b
return max(0.0, f)
# A genuinely good strategy: 55% win rate, 1.5:1 payoff.
# full Kelly = 0.55 - 0.45/1.5 = 0.25 -> risk 25% of equity per trade
#
# Full Kelly on this strategy produces expected drawdowns exceeding 50% and
# assumes the 55% and the 1.5 are known exactly. They are estimates from a
# finite sample; if the true win rate is 50%, full Kelly is a losing bet.
#
# half Kelly = 12.5% still aggressive
# quarter Kelly = 6.25% the upper end of what most practitioners use
#
# Most professional risk budgets land between 0.5% and 2% — far below even
# quarter Kelly — because the edge estimate is uncertain and ruin is permanent.A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…