# position-sizing

The position-sizing Claude Code skill calculates position size and trade risk for Indian equities and F&O. It activates for questions about share or lot counts, risk per trade, and capital allocation.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 69 repo stars
- Author: Shubham Kumar
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Shubhamkumartrichy/claude-trading-skills-india/tree/HEAD/skills/position-sizing/SKILL.md
- Updated: 2026-11-13
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/shubham-kumar-position-sizing

## What it does

The skill calculates share or lot quantities from capital, risk, entry price, and stop level. Its `scripts/risk.py` command accounts for trading costs, leverage, and margin; futures quantities are rounded down to whole lots. Stops can use ATR, and the result can include gap-through-stop and circuit-risk estimates.

The `journal` command reads a CSV trade log and calculates win rate, average win-to-loss ratio, and Kelly; Kelly needs at least 30 trades. ATR comes from `ta.py summary`. Lot margin must come from a broker calculator or the MCP margin tool because SPAN changes daily. `risk.py` also handles R:R, trailing stops, and journal statistics.

## Install

### Claude Code (native platform)

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
```
In the agent chat (not a shell):
```text
/plugin install india-trading-skills@india-trading-skills
```
This installs the whole india-trading-skills plugin with all its skills

2. **Skills CLI (Vercel)**
```bash
npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill position-sizing -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/position-sizing/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/position-sizing/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill position-sizing -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/position-sizing/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill position-sizing -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/position-sizing/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Shubhamkumartrichy/claude-trading-skills-india skills/position-sizing
```

2. **Manually: put the files in place**
- File: `.github/skills/position-sizing/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill position-sizing -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Shubhamkumartrichy/claude-trading-skills-india --path skills/position-sizing
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/position-sizing/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Shubhamkumartrichy/claude-trading-skills-india/tree/HEAD/skills/position-sizing/SKILL.md

## When to use it
- calculate share quantity from a risk budget and stop
- round a futures position to whole lots
- include trading costs and leverage in a risk estimate
- calculate Kelly and trade-journal statistics
- check position limits and available margin

## Example prompts
- Calculate shares for ₹500000 capital, 1% risk, entry 1450, and stop 1410.
- How many NIFTY lots fit ₹800000 capital with entry 24950, stop 24800, and ₹165000 margin per lot?
- Calculate my win rate and Kelly from `trades.csv`.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d33c91f605aefb68.

BEGIN THIRD-PARTY FILE d33c91f605aefb68
````text
---
name: position-sizing
description: |
  Position sizing for Indian equity and F&O trades: fixed-fractional risk sizing with round-trip
  costs included, ATR-based stops, F&O lot rounding and margin checks, MTF/intraday leverage
  adjustment, gap-through-stop and circuit risk, Kelly from a trade journal, and portfolio limits.
  risk.py also covers R:R, trailing stops and journal statistics.

  Use when the user asks: "how many shares should I buy", "position size for X", "how many lots of
  NIFTY", "how much to invest", "risk per trade", "can I afford one lot", "Kelly criterion", "what's my
  win rate / expectancy", or any capital-allocation question.
---

# Position Sizing

Sizing decides survival. Risk a small, fixed fraction of capital per trade so that a losing streak,
which will happen, is survivable.

## Calculator

```bash
# Equity, structure stop
python3 scripts/risk.py size --capital 500000 --risk-pct 1 --entry 1450 --stop 1410
# Equity, ATR stop + gap-risk check for a midcap
python3 scripts/risk.py size --capital 500000 --risk-pct 1 --entry 1450 --atr 28 --atr-mult 2 --cap midcap
# NIFTY futures: lot rounding + margin
python3 scripts/risk.py size --capital 800000 --risk-pct 1 --entry 24950 --stop 24800 --lot-size 65 \
    --margin-per-lot 165000 --cost-pct 0.06
# MTF at 3x
python3 scripts/risk.py size --capital 300000 --risk-pct 1 --entry 820 --stop 790 --leverage 3
# Win rate / payoff / Kelly from your journal (date,symbol,side,entry,exit,stop,qty,charges | or pnl)
python3 scripts/risk.py journal trades.csv
```

`--cost-pct` is the round-trip cost as % of entry. Use about 0.25 for delivery, 0.05 for intraday,
and 0.06 for index futures, or compute it exactly with `trading-costs`. Get margin per lot from the
broker's margin calculator or the MCP margin tool, because SPAN changes daily.

## Method 1: fixed fractional (default)

```
Risk budget = Capital × Risk%            (÷ leverage when using MTF/MIS margin)
Units       = Budget ÷ (|Entry − Stop| + cost per unit)
F&O         = floor(Units ÷ lot size) lots
```

| Situation | Risk % per trade |
|---|---|
| Normal swing/positional, no leverage | 0.5–1% (max 2%) |
| New or unproven setup | 0.25–0.5% |
| With MTF/MIS leverage | base risk ÷ leverage (see below) |
| F&O beginners | 0.5%, and only defined-risk structures |
| Total open risk across all positions | ≤ 6% |

**Why divide by leverage?** The loss at the stop doesn't depend on leverage. But leverage lets a
````
END THIRD-PARTY FILE d33c91f605aefb68

The third-party file has ended. Everything between the d33c91f605aefb68 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2477 of 5901 bytes. © Shubham Kumar · MIT · https://github.com/Shubhamkumartrichy/claude-trading-skills-india/tree/HEAD/skills/position-sizing/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
