Case Study 02 Personal Project

Algo Trading
Platform

A production-grade, full-stack algorithmic trading system for NSE F&O — live options analytics, Black-Scholes Greeks, PCR heatmaps, a backtesting engine, and real/paper trading via Fyers API. Built entirely from scratch.

94+ F&O Stocks Scanned
5 Greeks Computed Live
30s OI Refresh Rate
4 Run Modes
Backend
PythonFastAPIPandasNumPySciPySQLite
Frontend
React 19ViteTailwindRechartsZustand
Data
Fyers API v3NSE F&OWebSocket
Role
Solo Build

Options dashboard screenshot coming soon

Drop your options chain / OI heatmap screenshot here

NISM-certified. Trading manually. Wanted an edge.

After earning my NISM-Series-VIII Equity Derivatives certification and working as a Dealer Executive at Swastika Investmart, I had hands-on experience executing trades and monitoring options positions for clients daily. But every key decision — reading the options chain, tracking OI buildup, identifying flow signals — was done manually, in real time, under pressure.

I wanted to build a system that automated the analytical layer: one that could watch 94 F&O stocks simultaneously, compute Greeks and PCR live, detect volume surges, and execute or simulate trades with proper risk guardrails — all while I focused on strategy, not data entry.

Manual options analysis across 94 stocks in real time is impossible. A systematic, automated platform was the only way to get a real edge.

Full-stack. Real-time. Four run modes.

The platform is built as a Python FastAPI backend with a React frontend, connected to the Fyers API v3 for live NSE data and order execution. It supports four distinct run modes and maintains persistent WebSocket connections for real-time tick delivery.

1

Live Data Layer — Fyers WebSocket

A persistent FyersDataSocket connection streams real-time tick data (quotes, volume, OI) for all subscribed symbols. The market feed caches the latest tick per symbol and broadcasts to connected frontend clients.

2

OI Service — 30-Second Option Chain Polling

A background asyncio task polls the Fyers option chain REST API every 30 seconds for NIFTY and BANKNIFTY. Computes PCR (asymmetric CE/PE windows), Max Pain, ATM IV, and OI change — then broadcasts via WebSocket to the options dashboard.

3

Flow Service — 10-Second Volume Surge Detection

Every 10 seconds, CE and PE strikes are polled for volume. The service computes 3-minute volume surges per strike and a Put-Call Volume Ratio (PCVR) signal — flagging when unusual options flow is detected before it shows up in OI.

4

Scanner — 94 Stocks, Every 15 Minutes

A background scanner runs on every 15-minute candle close, pulling historical OHLCV for all 94 NSE F&O stocks. Applies EMA cross, RSI, and Supertrend signals — pushes alerts to the frontend for any triggered conditions.

5

Algo Engine — State Machine with Risk Guardrails

The central AlgoEngine manages state (STOPPED / RUNNING / PAUSED), tracks real-time P&L, enforces a daily loss limit kill-switch, and applies three discipline guardrails: a Confirmation Gate (N consecutive candles), Cooldown Manager (post-loss pause), and Discipline Journal (logs violations and cost).

6

Order Execution & Paper Trading

Orders (MARKET, LIMIT, SL, SL-LIMIT) route through the order manager, which validates kill-switch status and available margin before placing via Fyers API. A parallel paper trader simulates fills at live prices with virtual P&L tracking — no real capital at risk during testing.

Greeks. PCR. Max Pain. All live.

The options analytics engine is the core of the platform — computing everything a derivatives trader needs in real time, from scratch in Python.

Black-Scholes Greeks

Full BS implementation: IV computed via bisection method, then Delta, Gamma, Theta, Vega, and Rho calculated live for every strike on the chain.

PCR (OI & Volume)

Asymmetric Put-Call Ratio using separate CE (ATM−2 to ATM+4) and PE (ATM−4 to ATM+2) windows. BULLISH above 1.3, BEARISH below 0.7. 15-minute history tracked.

OI Heatmap

Color-coded OI change grid across all strikes — green for buildup, red for unwinding. Gives an instant visual read on where smart money is positioned.

Max Pain

Strike price at which total loss across all CE and PE open interest is minimised — computed fresh every 30 seconds with distance-to-spot displayed.

Volume Surge & Flow

3-minute rolling volume surge per strike flags unusual activity. PCVR (PE surge ÷ CE surge) detects directional flow before OI reflects it.

Technical Indicators

EMA cross (9/21), Wilder's RSI, ATR-based Supertrend, and Pivot Points (PP, S1/S2, R1/R2) — all computed from raw OHLCV using NumPy, no TA library dependency.

Validate before you risk real capital.

Every strategy runs through the event-driven backtester before going live. The engine iterates historical OHLCV row-by-row, applies the strategy's signal logic, and produces a full performance report.

Win Rate % of profitable trades vs total trades
Profit Factor Sum of winners ÷ sum of losers
Drawdown (Peak equity − current) ÷ peak × 100%
Equity Curve Visual P&L over time via matplotlib

Paper trading mode mirrors the live engine exactly — same signals, same order routing, same risk guardrails — but fills at live prices with virtual capital.

Three layers of discipline built in.

Trading psychology is as important as the signal. The platform enforces three programmatic guardrails that prevent the most common causes of trading losses.

01

Kill-Switch — Daily Loss Limit

If the day's P&L drops below a configured threshold, the engine halts all new orders automatically. No override without a manual restart — prevents spiralling losses from emotional revenge trading.

02

Confirmation Gate — N Candles Agreement

A signal is only acted on after N consecutive candles confirm the same direction. Eliminates false breakouts and whipsaw entries that look good on a single candle.

03

Cooldown Manager — Post-Loss Pause

After a losing trade, the engine enforces a configurable cooldown period before accepting new signals. Every violation is logged with its cost in rupees to the Discipline Journal.

What building this taught me.

Async architecture is non-negotiable for real-time systems

Running market feed, OI polling, flow service, and scanner as concurrent asyncio tasks — while serving a FastAPI REST + WebSocket server — required careful design to avoid blocking and data races.

Black-Scholes from scratch beats a library

Implementing IV bisection and all five Greeks manually gave full control over precision, edge cases, and performance — and deepened my understanding of options pricing significantly.

Paper trading before live is not optional

Running weeks of paper trades surfaced bugs in order routing and signal timing that would have been costly in live mode. The parallel paper/live architecture was one of the best design decisions in the project.

Next Case Study

MIS Trading Performance Framework

P&L tracker, drawdown calculator, and Sharpe ratio model built for a brokerage.