Algorithmic Options
Trading Engine
An intraday systematic trading engine for NSE index options (Nifty / BankNifty) — designed, built and operated end to end as an independent project. What follows emphasises engineering and statistical rigor over profit.
How it fits together
Analytics & dashboards
Every research decision is made in front of data, not spreadsheets. The engine ships interactive dashboards — built with charting libraries like TradingView Lightweight Charts and Chart.js — that put price action, indicators and portfolio behaviour side by side. A strategy's logic can be inspected bar by bar, and its results judged across full market regimes rather than a single flattering stretch. Price panes overlay moving averages, OI/PCR and regression-trend metrics; portfolio panes track how capital compounds and, just as importantly, how deep and how long its losing stretches run.
Price action · 50-EMA overlay
Actual NSE Nifty session (30 Jun 2026), per-minute, with a 50-period EMA overlay.
Points growth · Jan–Jun 2026
Backtested points growth with daily change (green/red), ending at 5,171.60 points.
Drawdown
The underwater view — points below the running peak.
Sample per-candle payload
One minute of the parsed feed the engine consumes — price, volume, standard indicators, option greeks and option-chain context. Proprietary signals and how they are derived are omitted.
{
"time": "12:35:00",
"candle": {
"open": 23921.20, "high": 23925.95, "low": 23917.55, "close": 23924.85,
"volume": 807906,
"ema": 23925.13, "adx": 14.41, "atr": 7.14
},
"option_expiry": "NSE:NIFTY-2026-JUN",
"ce_openinterest": 259272965,
"pe_openinterest": 226606995,
"ce_vol": 4755458825,
"pe_vol": 4848621440,
"support": 23700,
"resistance": 24000,
"greeks": {
"atm_strike": 24000,
"ce": { "delta": 0.52, "gamma": 0.00110, "theta": -8.40, "vega": 12.30, "iv": 12.8 },
"pe": { "delta": -0.48, "gamma": 0.00110, "theta": -7.90, "vega": 12.10, "iv": 13.4 }
}
}
Engineering
Live/backtest parity on a single code path — the same logic replays history or streams live.
Platform
Flask platform with Redis-backed live state, a per-minute option-chain data pipeline, and live order execution via the Fyers broker API.
Live/backtest parity
A single code path replays history or streams live — enabling reproducible research over 3 years of minute-level data (~950 trades).
Architecture & ops
Producer/consumer on Redis Streams; automated daily broker authentication (TOTP / session-trust); reproducible research runs from versioned configs.
Analytics dashboards
Interactive dashboards (TradingView Lightweight Charts, Chart.js) with price, OI/PCR, regression-R² trend, and peak/valley swing-overlay panes.
Quant Research & Signals
Microstructure-driven strategies engineered from raw per-strike option data.
8 intraday strategies
Mean-reversion fades, capitulation reversals, breakout, and expiry max-pain pin — driven by OI, PCR, volume z-scores, RSI, support/resistance, and option-chain microstructure.
Engineered features
ATM straddle (expected range), max-pain, GEX via Black-Scholes implied-vol back-out, and regression-based regime metrics — slope, R², trendiness.
Configurable exit framework
Exits are researched as first-class hypotheses, not fixed one-size targets — run through the same backtest pipeline as entries, and each change gated on year-by-year consistency before it ships.
Statistical Validation
the differentiatorTelling genuine edge from overfit noise — the layer most of the effort went into.
Out-of-sample gating
Per-year consistency used as a gating test — repeatedly eliminated in-sample-only "edges," including a parameter that proved to be a single-year overfit.
Fragility & tails
Parameter perturbation / fragility sweeps, tail/skew decomposition to isolate where edge structurally lives, and capture-ratio (MFE vs. realized) analysis.
Multiple-testing discipline
Each idea treated as a hypothesis required to survive out-of-sample testing — with rejected approaches documented to avoid re-deriving dead ends.
Monte Carlo stress test
10,000 simulated runsA backtest gives one number. Three years of the engine's backtest produced 965 trades — but that's just the one history that happened to unfold. Two Monte Carlo experiments, 10,000 runs each on the actual trade results, answer a sharper question: was that luck, and what should the engine actually be prepared for? For the plain-English version of this idea, see Monte Carlo, explained with a deck of cards.
Permutation · sequence risk
The same 965 trades, shuffled into a new order. Total profit is unchanged — but drawdowns and losing streaks are properties of sequence, not strategy, so this reveals the full range of drawdown paths the same trades could have produced.
Bootstrap · outcome risk
965 trades resampled with replacement, so each run is a plausible alternate 3-year history drawn from the same trade distribution — testing whether the profitability itself is fragile.
Worst drawdown across 10,000 shuffled orderings of the same 965 trades
The edge is not luck
Profitable in 100% of 10,000 bootstrapped 3-year histories — even the 5th-percentile profit factor was 1.93 (backtest: 2.21). No single lucky streak is carrying the results.
Observed drawdown understates risk
The lived -436 pt drawdown sits near the 75th percentile of shuffles — a quarter of orderings were worse. Honest planning numbers: -554 (95th) and -667 (99th).
Long losing streaks are normal
At a ~48% win rate, the median reordering contained a 10-trade losing streak; the 95th percentile was 13. If it arrives live, it's within spec.
Regime-stable
Split by year, three very different markets produced nearly identical drawdown and losing-streak distributions — not an artifact of one market mood.