TradLyt API¶
ML position-sizing for index option strategies. Score every leg of your strategy by its loss-risk at entry and size each one accordingly — smaller on the risky legs, larger on the clean ones — while your average exposure stays near flat. One call per leg live, or upload a backtest CSV to see the out-of-sample uplift before you wire it in.
Need an API key?
Generate one in your Profile page.
What it does¶
Our proprietary ML model scores each option leg's loss-risk and turns that into a position size — down-sizing the risky legs and keeping (or up-sizing) the clean ones.
Every leg is still traded — it's a sizing overlay, not a filter and not leverage. It works on short-premium strategies — naked or hedged (straddles, strangles, iron-fly / condor and their delta-shift / stop variants), intraday or positional, where it lifts out-of-sample Sharpe materially at equal average exposure — see the case study.
| Live — naked | POST /api/v1/sizing/leg-size — size one leg |
| Live — hedged | POST /api/v1/sizing/structure — size a whole structure, buy:sell ratio preserved |
| Backtest | run on the /backtest page (app) → your weight_norm, De-risk flat-vs-sized |
| Auth | X-API-Key: tlyt_… (see Authentication) |
| Scope | Index options only — NIFTY / SENSEX |
| Fallback | If the model is unavailable you get a flat weight (size = base) — never blocked |
Quick start¶
1 — Get your strategy's weight_norm. Run a backtest on the /backtest page in the app — it
validates the edge (rolling-quarter walk-forward, De-risk sizing) and returns your calibrated_weight_norm.
2 — Size each leg live. Pass that weight_norm, the horizon, and the mode on every call:
curl -X POST https://api-beta.tradlyt.com/api/v1/sizing/leg-size \
-H "X-API-Key: tlyt_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"underlying": "SENSEX",
"option_type": "CE",
"direction": "SELL",
"strike": 74100,
"expiry_date": "2026-06-12",
"base_lots": 10,
"weight_norm": 0.497,
"horizon": "intraday",
"mode": "derisk"
}'
{
"recommended_lots": 8,
"risk": 0.63,
"weight": 0.79,
"mode": "derisk",
"horizon": "intraday",
"sizing_active": true,
"norm_source": "strategy",
"method": "ml"
}
You wanted 10 lots; this leg scored mid-risk, so the model says trade 8. Do that for every leg — the riskier legs come back smaller, the clean ones larger, and your average lands back near your base. Full field reference is in Sizing & backtest; end-to-end code is in Examples.
What this API will not do¶
- Predict the market — it never says "NIFTY will go up."
- Pick strikes or entries — it sizes the legs you choose.
- Add leverage — average size stays near your base; it re-distributes and de-risks, it doesn't blindly amplify.
- Work on every strategy — it's for short-premium structures (naked or hedged); on long or tightly-capped (narrow-spread) structures the backtest verdict honestly says "run flat."