This is the capstone. We take everything — the basics, the Greeks, pricing, volatility, strategies and risk — and assemble it into one small, disciplined, end-to-end options algo. Not a money printer; a careful system that does the boring things perfectly.
The architecture
Every systematic strategy, however simple or fancy, runs the same loop:
- Fetch — the option chain, spot, and IV (Lesson 11).
- Signal — does your rule fire right now?
- Risk check — size the position, compute the max loss, confirm margin and that you are within your limits. This gate can veto the trade.
- Order — enter, with a stop-loss or hedge already attached.
- Monitor — track P&L, apply your exit rule, and square off intraday positions before the close (e.g. by 3:20pm).
…looping every tick or every minute, wrapped in a kill-switch that flattens everything the instant anything looks wrong.
A worked example strategy
Let us make it concrete with a defined-risk, systematic idea — for illustration only, not a recommendation:
“When India VIX / IV rank is high, sell a defined-risk iron condor on Nifty for the weekly expiry, with a hard stop-loss and intraday square-off.”
The logic: high IV means premiums are rich and volatility is likely to mean-revert (Lesson 6); an iron condor (Lesson 9) profits if Nifty stays in a range, collecting theta; and because it is a condor (with wings), the risk is defined (Lesson 8). Every piece comes straight from an earlier lesson. A skeleton:
def run_once(broker, cfg):
chain, spot = broker.option_chain("NIFTY", cfg.expiry), broker.ltp("NIFTY")
iv_rank = compute_iv_rank(chain) # Lesson 6
# 2. SIGNAL
if iv_rank < cfg.min_iv_rank:
return "no signal — IV too low to sell premium"
# 3. RISK CHECK (veto gate)
condor = build_iron_condor(chain, spot, width=cfg.width) # defined risk
if condor.max_loss > cfg.capital * cfg.max_risk_pct: # e.g. 2%
return "skip — position too big for risk budget"
if broker.free_margin() < condor.margin_required:
return "skip — not enough margin"
# 4. ORDER (enter all legs; stop attached)
order_ids = broker.place_multi_leg(condor.legs)
broker.attach_stop(order_ids, loss=condor.max_loss * cfg.stop_frac)
# 5. MONITOR handled by the main loop: P&L, exit rule, square-off by 15:20
return f"entered condor, max_loss={condor.max_loss}, iv_rank={iv_rank}"
# main loop (simplified)
while market_open():
try:
log(run_once(broker, cfg))
enforce_exits_and_square_off(broker, cfg)
except Exception as e:
kill_switch(broker) # flatten everything, stop trading
alert(f"KILLED: {e}")
break
sleep(60)Notice how little of this is “clever”. The signal is one line. The vast majority of the code is risk checks, stops, square-off and the kill-switch — and that is exactly right. In a live options algo, the discipline is the strategy.
The realities that separate a demo from a live algo
A demo ignores these; a live system cannot:
- Size for survival. Every position’s worst case must be survivable — defined risk, a small % of capital (Lesson 10). This is rule zero.
- A stop or hedge on every short. Never run a naked short option without a defined exit or a protective wing.
- Handle the messy path. Order rejects, partial fills, disconnections, intraday margin changes — handle them gracefully, don’t assume success.
- Square off intraday. Don’t carry surprise positions overnight unless the strategy is explicitly designed for it. Flatten before the close.
- Count costs honestly. Brokerage, STT (higher on the sell side), exchange fees and slippage — a strategy that looks great before costs often loses after them. Model them in the backtest and the live P&L.
- Start on paper, then one lot. Paper-trade the whole loop for weeks (Lesson 11), then go live with a single lot, and scale extremely slowly.
Pitfalls
- Optimising the signal, neglecting the risk code. The signal is the easy, small part. The risk checks, stops, square-off and kill-switch are what keep you alive — spend your effort there.
- No kill-switch, or an untested one. It must actually flatten everything and stop trading. Test it deliberately.
- Believing the backtest. Options backtests are especially easy to fool yourself with (Lesson 11). Forward paper-trading is the real test.
Recap — and the course in one line
A simple options algo is the loop fetch → signal → risk check → order → monitor, with intraday square-off and a kill-switch. The architecture is simple; the discipline — sizing for survival, stops on every short, handling the messy path, counting costs, paper-first — is the entire game. Boring, disciplined and small beats clever and big, every single time.
And the whole course in one line: options are leverage on direction, time and volatility — understand all three, compute them like the programmer you are, respect the risk above everything, and never trade size that can blow you up. You now have the foundations, basic and a fair bit of the advanced. Go and paper-trade, patiently.
For more, see the Low-Latency Trading Systems course, the algo trading vocabulary, position sizing with Kelly, and where to get market data.