trader-in-risk
/trader-in-risk
Sprawdza transakcje intraday na NSE i BSE względem limitów w rupiach, wliczając koszty, zanim trafią do brokera.
- Autor
- bhardwajaditya ↗
- Repozytorium
- day-trader-skill-india ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 1
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
- 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
Skrypty: check.py
Co robi i kiedy
Sprawdza transakcje intraday na NSE i BSE względem limitów w rupiach, wliczając koszty, zanim trafią do brokera.
Argumenty
/trader-in-risk [path to orders.json]
Oryginalny opis (EN)
Risk Manager for Indian stocks (NSE / BSE). Checks every trade against your limits in ₹ and stops anything over them, before it can reach the broker (Zerodha Kite, Upstox ...). For an intraday (MIS) trade: a stop is required, the loss at the stop plus the estimated round-trip costs (brokerage, STT, exchange, SEBI, stamp duty, GST) must fit your max loss per trade, reward:risk must meet your minimum, the day's total risk must fit your daily loss limit, no more than your trades per day, and no new MIS entries outside your entry window or when the NSE market is closed (IST, NSE holidays built in)
Jak działa
- What it reads and writes
- Entries and exits
- The checks
- Steps
- Example
- Rules
- What it never does
- Safety
Podgląd SKILL.md
---
name: trader-in-risk
description: >-
Risk Manager for Indian stocks (NSE / BSE). Checks every trade against your
limits in ₹ and stops anything over them, before it can reach the broker
(Zerodha Kite, Upstox ...). For an intraday (MIS) trade: a stop is required,
the loss at the stop plus the estimated round-trip costs (brokerage, STT,
exchange, SEBI, stamp duty, GST) must fit your max loss per trade, reward:risk
must meet your minimum, the day's total risk must fit your daily loss limit,
no more than your trades per day, and no new MIS entries outside your entry
window or when the NSE market is closed (IST, NSE holidays built in). It also
checks whole-share qty, MIS / CNC product, MIS leverage (1 to 5) and the cash
it needs after your buffer, the tick grid (with the corrected price), NSE /
BSE exchange and trading symbol, blocked symbols, order size, position cap,
short sales, F&O contracts and indices like Nifty / Sensex, duplicates and a
daily order limit. Getting out is never blocked by a day limit. Prints PASS
or BLOCK with the reason and records the verdicts so trader-in-broker only
shows an order that passed. Use when the user says "check my order", "is
this safe", "risk check", "does this break my rules", "can I take this
trade", "how much have I risked today", "will this fit my ₹1,000 max loss",
or before /trader-in-broker, always.
argument-hint: "[path to orders.json]"
---
# trader-in-risk
The Risk Manager is the gate between a proposal and the broker. Every order
written by trader-in-budget or trader-in-broker's flatten passes through it. A
BLOCK is final for that order: it does not go to the user for a yes, and it
does not go to the broker. SEBI's own studies found that most individual
intraday traders in equity cash lose money. These limits keep each loss and
each day's losses small. They do not make a trade win.
`${CLAUDE_SKILL_DIR}` below is this skill's folder (where this SKILL.md lives).
```bash
python3 "${CLAUDE_SKILL_DIR}/check.py" # trader-in/ files; writes trader-in/state/risk.json
python3 "${CLAUDE_SKILL_DIR}/check.py" --json
python3 "${CLAUDE_SKILL_DIR}/check.py" --no-write # look without recording
python3 "${CLAUDE_SKILL_DIR}/check.py" --now "2026-10-27 10:15" # pin the clock (IST; bare 10:15 = today)
```
## What it reads and writes
| file | what |
| --- | --- |
| `trader-in/orders.json` | the proposed orders (trader-in-budget, or trader-in-broker's flatten) |
| `trader-in/config.json` | the limits (`capital_inr`, `max_loss_per_trade_inr`, `product`, `mis_leverage` ...) |
| `trader-in/portfolio.json` | cash and holdings; if missing, a fresh account funded with `capital_inr` |
| `trader-in/prices.json` | a fresh price raises the entry it measures risk from; also values holdings |
| `trader-in/state/broker.json` | what was placed today: duplicates, trades per day, daily loss |
| `trader-in/state/risk.json` | the verdicts it writes, with a fingerprint of each exact order |
Symbols are the Yahoo form: `RELIANCE.NS` (NSE), `RELIANCE.BO` / `500325.BO`
(BSE). `RELIANCE`, `NSE:RELIANCE` and `BSE:500325` are read too, with a
warning to write the canonical form.
## Entries and exits
An **entry** opens or adds to a position: a buy, or a sell that would go
short. An **exit** only reduces what you already hold. Getting out must
always be possible, so an exit is checked for format, ticks, exchange, asset
and short sales only. Every other rule (day limits, entry window, loss,
reward:risk, blocked list, size, leverage, duplicates) turns into a warning
for an exit, never a BLOCK. Your broker squares off MIS positions from about
15:20 IST (for a fee): get out before that, by your `flat_by` (15:10).
## The checks
Orders are checked in file order, as if each passed order had filled, so a
batch that is fine order by order but breaks a limit together is caught.
| check | blocks when |
| --- | --- |
| format | no symbol, side not buy or sell, `qty` not a whole number ≥ 1, a notional (₹ amount) order, `product` not MIS or CNC, an unknown type (market, limit, SL, SL-M), a limit / SL order with no `limit_price`, an SL / SL-M with no `trigger_price`, a bracket without its `stop_loss_trigger_price` or `take_profit_limit_price` |
| exchange | `exchange` not NSE or BSE, or not the symbol's (`.NS` = NSE, `.BO` = BSE); `tradingsymbol` not the symbol without its suffix |
| tick | a limit, trigger, stop or target price off the tick grid; the reason gives the corrected price (stop and target round down, a buy limit up) |
| asset | F&O contracts (`NIFTY26OCT25000CE`, `RELIANCE26OCTFUT`), indices (`^NSEI`, `^NSEBANK`, `^BSESN`, NIFTY, SENSEX), crypto or anything that is not an NSE / BSE cash-equity symbol |
| short | a sell of more than you hold (`allow_short` false); a CNC short always |
| blocked | (entries) the symbol is on the `blocked` list |
| size | (entries) under `min_order_inr` or over `max_order_inr` |
| position | (entries) the stock would be over `max_position_pct` of the account |
| margin | (entries) `mis_leverage` outside 1 to 5; the cash needed (notional / `mis_leverage` for MIS, the full notional for CNC) would leave less than the cash buffer |
| stop | (entries) no stop while `require_stop` is true; a stop on the wrong side of the entry |
| loss | (entries) qty x (entry minus stop) + estimated round-trip costs at the stop (with `include_costs_in_risk`) over `max_loss_per_trade_inr` |
| reward:risk | (entries) (target minus entry) / (entry minus stop) under `min_reward_risk` |
| daily loss | (entries) the max losses at the stops of today's entries, plus this one, over `max_daily_loss_inr` |
| trades | (entries) `max_trades_per_day` entries already placed today |
| window | (MIS entries) before `no_entries_before` (09:30) or after `no_entries_after` (14:45) IST, or the NSE market is closed |
| duplicate | (entries) the same symbol and side twice in one batch, or already placed today |
| daily limit | (entries) `max_orders_per_day` orders already placed today |
How the numbers work:
- **The entry it measures from**: the limit price for a limit or SL order,
the trigger for SL-M. For a market order, the HIGHER of the plan's entry and
a fresh price from `trader-in/prices.json` (under 15 minutes old). An older
price is not used, and it says so.
- **Costs** are an estimate, the same formula as trader-in-budget, -broker
and -timemachine (`estimate_costs`): MIS brokerage min(₹20, 0.03%) a leg,
STT 0.025% of the sell (CNC: 0.1% of both legs, no brokerage), exchange
charge NSE 0.00297% / BSE 0.00375%, SEBI ₹10 a crore, stamp duty 0.003% of
the buy (CNC 0.015%), GST 18% on brokerage + exchange + SEBI. Override any
rate in config `costs`. Your contract note has the real numbers.
- **Ticks** come from the order's `tick_size`, else config `tick_size`, else
NSE's price bands (<₹250: 0.01, <₹1,000: 0.05, <₹5,000: 0.10, <₹10,000:
0.50, <₹20,000: 1.00, else 5.00). NSE revises the bands monthly, so they are
an approximation; it warns when the order's tick differs from the band.
- **Daily loss** counts the full max loss of every entry placed today, win or
lose, as trader-in-broker logged it.
- **The window** is IST (UTC+05:30, no daylight saving), worked out in the
tool, never from the computer's clock zone. Session 09:15 to 15:30.
Weekends and the 2026 NSE holidays are closed; for a year with no built-in
list (2027) it warns and treats weekdays as open: add closures to
`extra_holidays`. Special sessions (Budget-day Sunday 2026-02-01, Muhurat
trading 2026-11-08, 14:20-15:30 IST per the NSE circular, pre-open from
14:05) are not normal days; override their hours with config
`special_sessions`. On a special session your entry window applies only
where it falls inside the session (Muhurat: entries 14:20-14:45). A
**CNC** entry is not held to the time window; when the market is closed it
is a warning (it would be an after-market order filling at the next open).
Warnings do not block, but say them to the user: a LIVE account, qty sent as
text, a missing `product` / `exchange` / `tradingsymbol` (worked out from the
config or the symbol), a stop that lives only in the plan and not at the
broker, a price too old to use, an AMO, a special session, a missing holiday
list.
## Steps
1. If the price may have moved since the plan, refresh it first
(trader-in-alerts: `alerts.py quote RELIANCE.NS --write`).
2. Run `check.py`. Exit code 0 means every order passed, 1 means at least one
was blocked.
3. Tell the user the result in plain words, order by order: the max loss at
the stop with costs, reward:risk, the cash it ties up, and how much of
today's limits it uses. For a BLOCK, give the reason and the fix (fewer
shares, a closer stop from trader-in-exit, the corrected tick, wait for the
window, or skip the trade). Never change a limit yourself.
4. If the order changes in any way, run the check again. trader-in-broker
matches each order to its verdict by fingerprint, so an edited order is not
ready until it passes again, and a verdict from yesterday does not count today.
## Example
The RELIANCE.NS bracket from trader-in-budget at 10:15 IST on Tuesday
2026-10-27, on a fresh ₹1,00,000 paper account with the default config:
```
PASS #1 buy RELIANCE.NS 12 shares MIS, entry
entry 1196.30 (the limit price), stop 1188.10, target 1212.70: risk 8.20 a share (tick 0.10)
max loss ₹113.56 = 12 x 8.20 + ₹15.16 est. costs (limit ₹1,000), reward:risk 2.00 (min 1)
MIS ₹14,355.60 notional, cash needed ₹14,355.60 (intraday, 1x leverage)
today before this: 0 of 3 trades, ₹0 of ₹3,000 daily loss
1 passed, 0 blocked at 2026-10-27 10:15 IST. Cash after the passed orders: ₹85,644.40 (paper account).
Costs are an estimate (brokerage, STT, exchange, SEBI, stamp duty, GST); your contract note has the real ones.
```
With a ₹100 max loss per trade the costs tip it over:
```
- loss: 12 shares x 8.20 risk a share = ₹98.40, plus ₹15.16 estimated costs = ₹113.56 at the stop, over your ₹100 max loss per trade
```
A stop at 1188.15 is blocked with `tick: stop_loss_trigger_price 1188.15 is
not on the 0.10 tick; use 1188.10`. At 09:29 it is blocked by the window (no
new MIS entries before 09:30); on 2026-11-10 (Diwali Balipratipada) the
market is closed. The 15:10 sell that closes the position passes, even after
the 14:45 entry cutoff: it is an exit.
## Rules
- A PASS only means the order is allowed to be shown to the user. It is not a yes.
- Every number comes from the config, the order, the portfolio, the prices or the broker log.
- Free Yahoo prices are unofficial and can lag; the broker's price is the one that fills, and an
SL-M stop can fill worse than its trigger in a fast market. The stop and target are separate
orders at an Indian broker, not OCO: when one fills, cancel the other.
## What it never does
It never places an order, never edits an order to make it pass, never
loosens a limit, never blocks a sell that only gets the user out, and never
treats a PASS as the user's yes.
## Safety
- Education and tooling, not investment advice. A PASS is a rules check, not a recommendation;
for advice, talk to a SEBI-registered investment adviser.
- Paper trading by default (`"paper": true`, a local simulated ledger in `trader-in/state/paper.json`).
Going live is the user's own decision, in their own config.
- Nothing in this pack places an order except trader-in-broker, and only when all three hold:
trader-in-risk passed that exact order today, the user typed an explicit yes for that one order
in the chat, and the user clicked Allow once on Claude's own card because the order tool is set
to "Needs approval". Never set an order tool to "Always allow".
- No F&O, no leverage above the config's `mis_leverage` (max 5), no short selling unless the
config allows it and the user confirms.
- Broker keys and access tokens live in environment variables or the Claude Desktop config,
never in the chat.
Pliki w paczce (2)
- SKILL.md 12 KB
- check.py 49 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · bhardwajaditya/day-trader-skill-india | 87 | MIT |
| ankurgoels/trader-skills-india | 87 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 6d1a87f0d6b3 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Podobne skille
- 87nse-risk
Sprawdza transakcje intraday na NSE względem limitów straty, stopu i godzin handlu, zanim trafią do brokera. - 87trader-risk
Sprawdza transakcje intraday na NSE względem limitów straty i kosztów, zanim trafią do Upstox. - 87trader-risk
Sprawdza zlecenia NSE, gotówkowe i F&O, względem limitów straty z kosztami, zanim trafią do brokera. - 87bharat-risk
Sprawdza każdą transakcję intraday na NSE względem limitów ryzyka i zatrzymuje te, które je przekraczają, zanim trafią do brokera. - 87trader-risk
Sprawdza każdą transakcję na akcjach gotówkowych NSE względem limitów straty i zysku, zanim trafi do brokera. - 87trader-risk
Sprawdza każdy plan transakcji względem limitów w rupiach, mierząc stratę netto po kosztach, zanim trafi do brokera.