Raw schema
{
"type": "object",
"properties": {
"spec": {
"description": "Either a preset spec (structure + params) or an open strategy (legs + rules). Use the open form for anything the presets cannot say.",
"oneOf": [
{
"type": "object",
"required": [
"structure",
"params"
],
"additionalProperties": false,
"properties": {
"structure": {
"type": "string",
"enum": [
"credit_spread",
"iron_condor",
"iron_fly",
"long_option",
"short_strangle"
],
"description": "Option structure to trade."
},
"symbol": {
"type": "string",
"enum": [
"NIFTY"
],
"description": "Free tier serves NIFTY only."
},
"params": {
"type": "object",
"description": "Structure parameters. pct_offset and pct_width are percent of spot. sl_mult is a multiple of the credit received; sl_pct and tp_pct are fractions of premium paid. entry_dte is days to expiry at entry. direction is CE or PE for directional structures, and must be omitted when a bias is set.",
"properties": {
"pct_offset": {
"type": "number",
"minimum": 0,
"maximum": 20
},
"pct_width": {
"type": "number",
"minimum": 0,
"maximum": 20
},
"sl_mult": {
"type": "number",
"exclusiveMinimum": 0
},
"sl_pct": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1
},
"tp_pct": {
"type": "number",
"exclusiveMinimum": 0
},
"entry_dte": {
"type": "integer",
"minimum": 0,
"maximum": 45
},
"entry_days_before": {
"type": "integer",
"minimum": 0,
"maximum": 30,
"description": "Entry day as TRADING SESSIONS before expiry (0 = expiry day, 2 = 'T-2'), instead of calendar entry_dte. Set one or the other."
},
"direction": {
"type": "string",
"enum": [
"CE",
"PE"
]
}
}
},
"entry_time": {
"type": "string",
"enum": [
"09:15",
"09:30",
"11:00",
"12:00",
"12:30",
"13:00",
"14:00",
"15:00",
"EOD"
],
"description": "IST. EOD is 15:29, the last tradeable minute."
},
"exit_time": {
"type": "string",
"enum": [
"09:15",
"09:30",
"11:00",
"12:00",
"12:30",
"13:00",
"14:00",
"15:00",
"EOD"
],
"description": "IST clock exit β squares the position off the SAME session, so it never reaches expiry. Omit to hold until a stop, a target or settlement. Must be after entry_time. Set this to express an intraday round trip such as in at 11:00, out at 14:00."
},
"cadence": {
"type": "string",
"enum": [
"weekly",
"daily"
],
"description": "'weekly' (default) enters ONCE per expiry, on the day matching entry_dte β about 58 trades a year. 'daily' enters EVERY trading session on whichever expiry is nearest β about 246. Use 'daily' for anything described as 'every day'."
},
"max_dte": {
"type": "integer",
"minimum": 0,
"maximum": 45,
"description": "cadence 'daily' only: skip sessions where the nearest expiry is further out than this. max_dte 0 is expiry-day only."
},
"gate": {
"type": "string",
"description": "Entry filter; 'always' to disable."
},
"overlay": {
"type": "string",
"pattern": "^vol[0-9]{1,3}$",
"description": "Volatility filter: 'vol20' skips a cycle when the index's 20-day realised volatility is above 20% at entry. Omit for none."
},
"bias": {
"type": "string",
"description": "Chooses the side each cycle for directional structures. 'neutral' to use a fixed direction instead."
},
"period": {
"type": "object",
"additionalProperties": false,
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
}
},
"description": "YYYY-MM-DD, inside 2025-07-01 to 2026-06-30."
}
}
},
{
"type": "object",
"required": [
"legs"
],
"additionalProperties": false,
"description": "An open strategy: any legs, any rules. Use this whenever the idea does not fit a preset β ratio spreads, calendars, diagonals, jade lizards, broken wings, delta- or premium-selected strikes, per-leg stops, rolling a tested side, trailing stops, entry conditions on the credit available, and book-level rules like standing down after three losers.",
"properties": {
"name": {
"type": "string"
},
"symbol": {
"type": "string",
"enum": [
"NIFTY"
]
},
"legs": {
"type": "array",
"minItems": 1,
"maxItems": 12,
"items": {
"type": "object",
"required": [
"side",
"type",
"strike"
],
"additionalProperties": false,
"properties": {
"side": {
"type": "string",
"enum": [
"sell",
"buy"
]
},
"type": {
"type": "string",
"enum": [
"CE",
"PE"
]
},
"qty": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"description": "lots of THIS leg relative to the others. Unequal quantities are how a ratio spread is written."
},
"expiry": {
"type": "string",
"enum": [
"near",
"next",
"far"
],
"description": "'near' is the nearest expiry at entry; 'next' is the one after, which is how a calendar or diagonal is written."
},
"strike": {
"description": "How to pick the strike. One of: {\"pct_offset\": 1.0} percent from spot (negative for puts) | {\"points_offset\": 200} | \"atm\" | {\"strike\": 24000} | {\"premium_near\": 50} the strike whose last real print is nearest 50 points | {\"delta_near\": 0.20} | {\"from_leg\": {\"leg\": 0, \"pct\": 0.5}} relative to another leg. Add {\"ref\": \"entry\"} to measure from the spot at entry rather than the spot now."
},
"label": {
"type": "string"
}
}
},
"description": "What to open. Leg order defines the indices rules use."
},
"entry": {
"type": "object",
"additionalProperties": false,
"properties": {
"cadence": {
"type": "string",
"enum": [
"weekly",
"daily",
"monthly"
],
"description": "weekly = one entry per weekly expiry; monthly = one per monthly expiry (the last of its calendar month); daily = one per session."
},
"time": {
"type": "string",
"description": "ANY minute of the session, e.g. '09:20'. Not a grid."
},
"dte": {
"type": "integer",
"minimum": 0,
"maximum": 60,
"description": "weekly/monthly only: days before expiry to enter. Defaults to 4 weekly, 21 monthly."
},
"max_dte": {
"type": "integer",
"minimum": 0,
"maximum": 60,
"description": "daily only: skip sessions further than this from expiry."
},
"when": {
"type": "object",
"description": "Optional gate on the cycle β the REASON for taking the trade. combined_premium is the credit on offer, so {\"combined_premium\": {\"gte\": 80}} means 'only if I collect 80 points'. Market state is here too: day_of_week, gap_pct, prev_day_move_pct, realised_vol_20d, vix, vix_change_pct, vix_prev_close. e.g. {\"vix\": {\"gte\": 15}}, {\"prev_day_move_pct\": {\"lte\": -1}}, {\"day_of_week\": {\"eq\": 1}} for Mondays. INDEX INDICATORS too, computed on closes up to YESTERDAY: rsi_N (0-100), close_vs_sma_N_pct and close_vs_ema_N_pct (per cent above/below the N-day average), ema_F_vs_S_pct and sma_F_vs_S_pct (fast against slow, positive = fast is above). N from 2 to 250. e.g. {\"rsi_14\": {\"lt\": 30}} for oversold, {\"close_vs_ema_50_pct\": {\"gt\": 0}} for 'above the 50-day', {\"ema_9_vs_21_pct\": {\"gt\": 0}} for a 9/21 crossover. All are knowable before the session β none can see the day's own close."
}
}
},
"rules": {
"type": "array",
"maxItems": 24,
"description": "Checked every minute, in order; the first match fires. Fields: adjustments_done, combined_premium, credit_kept_pct, day_of_week, drawdown_from_peak, dte, gap_pct, leg_mark, leg_mark_delta, leg_mark_mult, leg_pnl_pts, minutes_held, pnl_pct_of_credit, pnl_pct_of_max, pnl_pts, pnl_rupees, prev_day_move_pct, realised_vol_20d, runup_from_trough, spot, spot_beyond_strike, spot_move_pct, spot_move_pts, time, vix, vix_change_pct, vix_prev_close. Actions: \"close\" | {\"close_legs\": [0]} | {\"open\": [leg,...]} | {\"roll\": {\"legs\": [0], \"to\": strike}} | {\"close_and_open\": {\"close\": [0], \"open\": [leg]}}.",
"items": {
"type": "object",
"required": [
"when",
"then"
],
"additionalProperties": false,
"properties": {
"when": {
"type": "object"
},
"then": {},
"max_times": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"label": {
"type": "string"
}
}
}
},
"exit": {
"type": "object",
"additionalProperties": false,
"properties": {
"time": {
"type": "string",
"description": "hard square-off at this minute on the entry day."
},
"when": {
"type": "object"
}
}
},
"max_adjustments": {
"type": "integer",
"minimum": 0,
"maximum": 50,
"description": "how many times the rules may change the position in one trade. Default 4."
},
"portfolio": {
"type": "object",
"additionalProperties": false,
"properties": {
"stop_after_losses": {
"type": "integer",
"minimum": 1
},
"stop_after_drawdown_pct": {
"type": "number"
},
"stop_after_profit_pct": {
"type": "number"
},
"skip_after_loss": {
"type": "boolean"
},
"max_trades": {
"type": "integer",
"minimum": 1
}
},
"description": "Rules over the SEQUENCE of trades, which no per-trade condition can express."
},
"resolution": {
"type": "integer",
"enum": [
1,
5,
15
],
"description": "minutes per rule check. 1 is the default and the honest one."
},
"period": {
"type": "object",
"additionalProperties": false,
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
}
}
}
}
}
]
},
"lots": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"detail": {
"type": "string",
"enum": [
"summary",
"standard",
"full"
],
"description": "How much per-trade data to return. 'standard' (default) is the equity curve, breakdowns and the first 25 trades with their leg prices. 'full' returns up to 300 trades β ask for it when the caller wants to audit or chart every trade. 'summary' returns aggregates only, and is the cheapest to read."
}
},
"required": [
"spec"
],
"additionalProperties": false
}