QuadraTrades System Architecture Manual

Institutional Multi-Strategy Intraday Option-Buying Platform for NIFTY 50

SYSTEM ARCHITECTURE 493 TESTS (100% PASS) FYERS API v3 AWS MUMBAI EC2 TUESDAY 0DTE & 65 LOT

1. Platform Overview & Engineering Philosophy

QuadraTrades is a production-grade algorithmic option-buying engine engineered for high-velocity momentum and volatility expansion trading on the NSE:NIFTY50-INDEX via the FYERS API v3.

Built across a comprehensive test-driven development roadmap, the platform unites ICT/SMC institutional order flow concepts, sub-second intra-candle tick execution, orthogonal multi-factor confluence scoring, dynamic Greeks-based strike selection, strict portfolio risk management, and a real-time dark-themed Web Operational HUD.

⚡ Sub-Second Intra-Candle Execution

Real-time tick evaluation at structural liquidity pools without waiting for candle close. Delivers 65% tighter stop distances and significantly higher Maximum Favorable Excursion (MFE) compared to retail candle-close entries.

🎯 4 Adaptive Scaling & Trailing Profiles

Custom tailored profit retention models per strategy:

  • Standard Balanced: 40% (+1.5R), 30% (+3R with +2R lock), 15% (+5R), 15% Free-Roll.
  • Trend Runner: 25% (+2R), 25% (+3.5R), 25% (+6R), 25% Structural Trail.
  • Expiry Gamma (0DTE): 50% (+1.5R), 40% (+2.5R), 10% Runner + 15m Stagnation.
  • Quick Harvest: 50% (+1.5R), 35% (+2.5R) for mean-reverting regimes.

🚀 Terminal Blow-Off Harvest (Mega-R)

Automatically liquidates 100% of runners at maximum expansion (+8R Standard, +10R Trend, +12R 0DTE Gamma, +4.5R Quick Harvest) to prevent violent late-session pullbacks.

⚖️ Single-Lot Profit Realization Policy

Solves the NSE lot size discretization barrier (1 lot cannot be split). Quick Harvest exits 100% at Milestone 2 (+2.5R); Standard/Trend locks a guaranteed +2.0R floor stop at Milestone 2.

🛡️ Hardened Risk Defense & Circuit Breakers

Maximum 35.0-point underlying stop ceiling, strict 3.0% account daily loss lockout, feed staleness circuit breaker (>5.0s network silence auto-exit), and 15:15 IST intraday square-off.

📊 Web Operational HUD & Dual CSV Export

Zero-dependency embedded multi-threaded HTTP server serving real-time REST APIs and dark UI, with dual one-click CSV export buttons for forensic accounting and journal archival.

2. 18-Strategy Institutional Suite Matrix

# Strategy Name Module Market Regime Signal Mechanism Target Option Atlas Link
01 Liquidity Sweep Reversal liquidity_sweep_reversal.py REVERSAL Key swing liquidity swept + reversal candle close Counter-Trend CE/PE Atlas 08 →
02 Liquidity Sweep FVG liquidity_sweep_fvg.py TREND, EXPANSION Sweep immediately mitigated into virgin Fair Value Gap Continuation CE/PE Atlas 07 →
03 BOS Continuation bos_continuation.py TREND, EXPANSION Break of Structure closure + Volume surge Trend Momentum CE/PE Atlas 01 →
04 FVG Retest fvg_retest.py TREND, EXPANSION Midpoint retest of virgin imbalance holding structure Continuation CE/PE Atlas 06 →
05 First Pullback first_pullback.py REVERSAL, EXPANSION Initial pullback to 9/21 EMA ribbon post-reversal Early Regime Shift CE/PE Atlas 05 →
06 VWAP Reclaim & Rejection vwap_reclaim.py TREND, REVERSAL Intraday probe beyond VWAP absorbed + violent reclaim Mean Reversion CE/PE Atlas 18 →
07 Opening Range Retest opening_range_break_retest.py EXPANSION, TREND 09:15–09:30 ORH/ORL breakout followed by level retest Morning Expansion CE/PE Atlas 09 →
08 Failed Breakout (Trap) failed_breakout.py REVERSAL, EXPANSION Swing breach with dominant rejection wick (>= 35%) Trap Reversal CE/PE Atlas 04 →
09 Compression Expansion compression_expansion.py EXPANSION, SQUEEZE Volatility squeeze box breakout (>= 1.25x ATR) Squeeze Breakout CE/PE Atlas 02 →
10 Trend Day Runner trend_day_runner.py TREND MONSTER Multi-timeframe trend alignment, ADX >= 22, VWAP hold Institutional Runner CE/PE Atlas 16 →
11 Expiry Gamma Blast expiry_gamma_blast.py 0DTE EXPIRY PHYSICS 0DTE afternoon acceleration post-13:00 IST into strikes 0DTE Delta/Gamma CE/PE Atlas 03 →
12 Opening Range Liquidity Trap opening_range_liquidity_trap.py REVERSAL, CHOPPY Fakeout of opening range high/low trapping early breakout Reversal CE/PE Atlas 10 →
13 Option Chain OI Imbalance option_chain_oi_imbalance.py DERIVATIVES SQUEEZE Heavy call/put writing unwinding + OI PCR surge Momentum CE/PE Atlas 11 →
14 Order Block Mitigation order_block_mitigation.py INSTITUTIONAL SMC High-probability unmitigated institutional order block tap Continuation CE/PE Atlas 12 →
15 Order Flow Divergence order_flow_divergence.py CVD VOLUME DELTA CVD volume delta divergence vs price highs/lows Counter-Trend CE/PE Atlas 13 →
16 Sniper Liquidity Reversal sniper_liquidity_reversal.py SUB-CANDLE TICK Sub-candle precision sweep with minimal stop (< 10 pts) Sniper CE/PE Atlas 14 →
17 Trendline Break Safety trendline_break_safety.py DIAGONAL STRUCTURE Multi-touch diagonal structural break + pullback retest Breakout CE/PE Atlas 15 →
18 Volume Profile OBV Force volume_profile_obv_force.py VOLUME EXPANSION High Volume Node breakout confirmed by aggressive OBV surge Trend Expansion CE/PE Atlas 17 →

3. Quickstart & Command Execution Runbook

To initialize the platform and start live paper trading on your workstation or remote cloud server:

# 1. Activate Python virtual environment .venv\Scripts\Activate.ps1 # 2. Launch production engine with Paper Trading & Web HUD python main.py --port 8080 --mode paper --capital 500000 # 3. Access Live Operational HUD in your browser http://127.0.0.1:8080 # 4. Run full test suite (493 unit tests) pytest -q

4. Operational HUD & REST API Endpoints

Endpoint Method Description
/ GET Responsive dark terminal HUD with real-time heartbeat, journal, and dual CSV exports
/docs/ GET Documentation & Architecture Portal indexing all technical guides and strategy atlases
/api/health GET System liveness, feed staleness status, server time, and uptime metrics
/api/state GET Consolidated JSON state spanning all operational domains
/api/market GET Spot price, futures basis, VWAP, ATR, ADX, and regime diagnostics
/api/structure GET Swing levels, Liquidity Pools, FVGs, Order Blocks, CHoCH, and BOS
/api/strategies GET 18 active strategies, primary setup, confluence scores, and agreement metrics
/api/option GET Active strike selection, Greeks (Delta, Gamma, Theta), bid/ask, and OI metrics
/api/trade GET Active trade status, entry, trailing stop, MFE/MAE, and R-multiple tracking
/api/account GET Available margin, daily realized P&L, risk limits, and trade counts
/api/actions/kill_switch POST Toggle remote emergency kill switch lockout
/api/actions/square_off POST Execute immediate emergency market auto-square-off of active positions