Volatility Harvesting Engine
Autonomous systematic trading platform for NSE equities
Overview
VHE is a single-process algorithmic trading terminal for Indian NSE equities that runs autonomously after start-up. It ingests live quotes (yfinance, a simulated tick generator, or the paid Zerodha Kite WebSocket), computes EMA/ATR/ADX indicators on every tick, classifies each symbol's market regime as RANGE, TREND, or CRASH, and runs three capital-allocated strategies through a shared risk engine before routing orders to a paper or live broker. A FastAPI backend streams full platform state over WebSocket to a React/TypeScript dashboard behind Google OAuth login, backed by a Monte Carlo risk engine and a walk-forward validation harness to guard against overfitting. It's deployed 24/7 on an Oracle Cloud Always Free ARM instance behind nginx and systemd, with 147 passing tests.
Architecture
- 01Quote feed (yfinance, simulated generator, or Zerodha Kite WS) ticks every 30s into a shared PlatformRuntime.
- 02IndicatorService and RegimeService update EMA-20/ATR-14/ADX-14 and classify each symbol as RANGE, TREND, or CRASH.
- 03StrategyOrchestrator runs the DynamicGrid, PairSpread, and Momentum strategies against the current regime and capital allocation.
- 04RiskGuard checks every order against loss, exposure, and sentiment rules before ExecutionEngine routes it to PaperBroker or KiteBroker.
- 05State is persisted to SQLite and broadcast over WebSocket to all connected dashboard sessions.
What I learned
- Building a regime-aware strategy orchestrator that arms and disarms strategies based on live ADX and drawdown signals.
- Using Monte Carlo bootstrapping and walk-forward splits to validate that a trading strategy isn't just overfit to history.