Systematic volatility arbitrage in short-dated equity-index options — trade only when the market is calm and the model says volatility is cheap.
Thesis • Architecture • Math • Results • Quickstart • References
Realised variance of equity indices is rough — the Hurst exponent
The engine operationalises this insight in three layers:
| Layer | Module | Method |
|---|---|---|
| Pricing | pricing_engine.py |
Stochastic Volterra MC (rough Bergomi) via Hybrid Scheme, Numba JIT |
| Risk | regime_filter.py |
2-state Gaussian HMM (Calm / Turbulent), Baum–Welch EM |
| Execution | connection_manager.py, execution_handler.py, orchestrator.py |
Async IBKR TWS, HDF5 tick storage, passive chase algorithm |
The central constraint is explicit:
Enter long volatility only if Regime = Calm and
$\sigma_{\text{model}} - \sigma_{\text{market}} > \Delta_{\text{entry}}$ . Exit / hedge when regime flips to Turbulent, spread compresses, or stop-loss / holding-time limits are hit.
The theoretical framework, methodology, and empirical results are documented in the accompanying paper:
"Rough Volatility Arbitrage under Markov Regime: Volterra Process Approach with Double Exponential" Mitchell Scott, Ph.D. & Felipe Cardozo — Emory University
LaTeX source: main.tex
┌─────────────┐ ticks ┌──────────────────────┐
│ IBKR TWS │ ───────────────▶ │ ConnectionManager │
│ (market data)│ │ tick_queue → HDF5 │
└─────────────┘ └──────────┬───────────┘
│ MarketState
▼
┌──────────────────────┐
│ StrategyOrchestrator │
│ 10ms tick loop │
│ 5s signal loop │
└───┬────────┬─────────┘
│ │
┌────────────┘ └─────────────┐
▼ ▼
┌────────────────┐ ┌────────────────┐
│ PricingEngine │ │ RegimeFilter │
│ (Volterra MC) │ │ (Gaussian HMM) │
└────────┬───────┘ └────────┬───────┘
│ OptionResult (price, IV) │ RegimeSignal
└───────────────┬───────────────────┘
▼
┌──────────────────────┐
│ Signal Generator │
│ (priority logic + │
│ PnL tracking) │
└──────────┬───────────┘
│ TradeSignal
▼
┌──────────────────────┐
│ ExecutionHandler │
│ (IBKR orders + │
│ chase algorithm) │
└──────────┬───────────┘
│ orders / mods
▼
IBKR TWS
| Component | Responsibility |
|---|---|
| ConnectionManager | Dual-inheritance EWrapper/EClient, daemon thread for run(), bounded tick queue, batched HDF5 writer, reconnect + subscription replay |
| Orchestrator | 10ms loop drains ticks into MarketState; every 5s queries HMM, prices ATM straddle via MC, inverts to model IV, runs priority-ordered decision tree |
| ExecutionHandler | Separate IBKR clientId for orders; passive chase starting at mid, moving one tick toward aggressive side every |
| SystemHealthMonitor | Periodic heartbeat logging: uptime %, ticks/min, queue occupancy, reconnect count, signal count |
Variance is driven by a fractional kernel with Hurst
with spot dynamics
Direct Euler–Maruyama is inconsistent when
Roughness of volatility paths (fBM, Volterra). Paths with H ≈ 0.07 exhibit the characteristic jaggedness absent from smooth diffusions at H = 0.5.
Monte Carlo convergence of the Hybrid Scheme. Standard error decays at the theoretical O(N⁻¹/²) rate, and the pricer cross-checks against Black–Scholes in the H = 0.5, ν → 0 limit.
Daily log-returns
with transition matrix
and the traffic-light rule gates all trading:
| Action | |
|---|---|
| Trade — full Kelly size permitted | |
| Delta hedge — no new entries | |
| Close all — stay flat |
Calibration uses Baum–Welch EM with multiple random restarts and vectorised forward–backward passes.
Regime detection map (Calm vs. Turbulent). The HMM reliably flags synthetic crisis regimes with lead time and high classification accuracy.
Given rolling excess-return estimate
The half-Kelly cap ensures robustness to estimation error. The regime filter gates
Signals follow a strict priority order (first match wins):
| Priority | Condition | Signal |
|---|---|---|
| 1 | Unrealised PnL |
STOP_LOSS → close all |
| 2 | Holding period max_hold_days
|
CLOSE_ALL |
| 3 | Close if positioned; hold flat otherwise | |
| 4 |
DELTA_HEDGE if positioned; no entry |
|
| 5 | Position open and IV spread |
CLOSE_ALL (alpha gone) |
| 6 | Calm regime, IV spread |
ENTER_LONG (open ATM straddle) |
| 7 | Default | HOLD |
Five-year synthetic study comparing naive always-on long-vol to the regime-adjusted strategy:
| Metric | Naive Long-Vol | Regime-Adjusted |
|---|---|---|
| Annualised Return | 5.1% | 7.3% |
| Annualised Sharpe | 0.87 | 1.38 |
| Maximum Drawdown | -22.4% | -12.7% |
| Calmar Ratio | 0.23 | 0.57 |
Most of the performance improvement is attributable to the HMM traffic-light preventing long-vol exposure during Turbulent regimes.
Strategy equity curves and drawdowns. The regime-adjusted strategy avoids the deep drawdowns that erode naive long-vol returns during turbulent episodes.
Transaction cost sensitivity of Sharpe ratio. The strategy remains profitable across a wide range of proportional cost assumptions.
The codebase includes reference implementations and visualisations of classical stochastic volatility models used for benchmarking and comparison. See examples_stochastic_processes.py and stochastic_processes_reference.md for equations and derivations.
Heston implied volatility surface. The smooth-diffusion model produces a symmetric smile that underestimates short-dated skew relative to the rough-vol pricer.
SABR volatility smile and term structure. The Hagan et al. (2002) approximation captures the smile shape but assumes smooth dynamics.
Dupire local volatility surface derived from the implied volatility smile. Local vol is a non-parametric alternative but suffers from instability in sparse data regions.
Hawkes jump-diffusion simulation. Self-exciting jumps capture contagion dynamics absent from continuous-path models.
HMM–Hawkes integration: regime-conditional intensity governs jump arrival rates, providing a richer model of crisis dynamics than the two-state Gaussian HMM alone.
Regime-Volatility-Arbitrage-Engine/
├── main.py # Entry point (--mode research|validate|test|paper|live)
├── config.py # Central configuration (pricing, regime, IBKR, storage)
├── pricing_engine.py # Rough-vol Volterra MC (Hybrid Scheme, Numba JIT)
├── regime_filter.py # 2-state Gaussian HMM (Baum–Welch, Viterbi, online)
├── orchestrator.py # Strategy loop, decision logic, position management
├── connection_manager.py # IBKR TWS connectivity, tick ingestion, HDF5 storage
├── execution_handler.py # Order execution, chase algorithm, fill logging
├── validation_suite.py # MC convergence + regime stability tests
├── main.tex # Academic paper (LaTeX source)
├── Analysis_and_Validation.ipynb # Research notebook
├── PROJECT_ARCHITECTURE.md # Detailed architecture reference
├── tests/
│ ├── test_pricing_engine.py
│ ├── test_orchestrator.py
│ ├── test_execution_handler.py
│ └── test_validation_suite.py
├── *.png # Generated figures
└── requirements.txt
Runtime data and logs (tick_data.h5, trade_log.csv, fills.csv, heartbeat.log) are not tracked by git.
git clone https://github.com/FelipeCardozo0/Regime-Volatility-Arbitrage-Engine.git
cd Regime-Volatility-Arbitrage-Engine
pip install -r requirements.txt| Mode | Command | IBKR Required | Description |
|---|---|---|---|
| Research | python main.py --mode research |
No | HMM calibration, rough-vol pricing, plot generation |
| Validate | python main.py --mode validate |
No | MC convergence + regime stability checks (CI-friendly) |
| Test | pytest tests/ -v |
No | Unit test suite |
| Paper | python main.py --mode paper |
Yes (port 7497) | Full system on IBKR paper trading |
| Live | python main.py --mode live |
Yes (port 7496) | Live trading — gated by validation + review |
All parameters live in config.py — nothing is hard-coded in strategy logic.
Pricing Engine
| Parameter | Default | Description |
|---|---|---|
HURST_EXPONENT |
0.07 | Roughness of volatility |
V0 |
0.04 | Initial variance |
LAMBDA_VOL_OF_VOL |
— | Vol-of-vol coefficient |
MC_PATHS |
— | Number of Monte Carlo paths |
MC_STEPS_PER_DAY |
— | Time resolution |
RISK_FREE_RATE |
— | Risk-free rate |
Regime Filter
| Parameter | Default | Description |
|---|---|---|
HMM_N_STATES |
2 | Calm / Turbulent |
HMM_TICKER |
SPY | Training asset |
HMM_HISTORY_YEARS |
— | Lookback window |
TURBULENCE_THRESHOLD |
0.6 | Baseline traffic-light cutoff |
IBKR Connectivity
| Parameter | Description |
|---|---|
TWS_HOST |
TWS hostname |
TWS_PAPER_PORT |
Paper trading port (7497) |
TWS_LIVE_PORT |
Live trading port (7496) |
TWS_CLIENT_ID |
Market data client; execution uses client_id + 1 |
HDF5_TICK_STORE |
Tick storage path (tick_data.h5) |
Gaussian Emissions
The HMM's Gaussian emission model understates tails. Student-$t$ or skewed emissions would better capture crisis dynamics.
Fixed Hurst Exponent
Synthetic Backtests
Current results are primarily synthetic. A full historical SPY options study is required before live deployment.
- Three-state HMM — Calm / Trending / Turbulent
- VIX term structure as additional HMM observation channel
- Intraday calibration via high-frequency options data (Polygon.io)
- HMM–Hawkes architecture — regime-conditional self-exciting jumps for contagion modelling
- Student-$t$ emissions for heavier-tailed regime filter
- Regime-conditional
$H$ — varying roughness across market states - Historical SPY options backtest with OptionMetrics / CBOE DataShop data
Expand full reference list
- Gatheral, J., Jaisson, T. & Rosenbaum, M. (2018). Volatility is rough. Quantitative Finance, 18(6), 933–949.
- Bennedsen, M., Lunde, A. & Pakkanen, M. S. (2017). Hybrid scheme for Brownian semistationary processes. Finance & Stochastics, 21(4), 931–965.
- Bayer, C., Friz, P. & Gatheral, J. (2016). Pricing under rough volatility. Quantitative Finance, 16(6), 887–904.
- El Euch, O. & Rosenbaum, M. (2019). The characteristic function of rough Heston models. Mathematical Finance, 29(1), 3–38.
- Heston, S. L. (1993). A closed-form solution for options with stochastic volatility. Review of Financial Studies, 6(2), 327–343.
- Hagan, P. et al. (2002). Managing smile risk. Wilmott Magazine, 1, 84–108.
- Rabiner, L. R. (1989). A tutorial on hidden Markov models. Proceedings of the IEEE, 77(2), 257–286.
- Hamilton, J. D. (1989). A new approach to the economic analysis of nonstationary time series. Econometrica, 57(2), 357–384.
- Thorp, E. O. (2011). The Kelly criterion in blackjack, sports betting, and the stock market. In The Kelly Capital Growth Investment Criterion, World Scientific.
- Felipe Cardozo — Mathematics & Computer Science, Emory University
- Mitchell Scott, Ph.D. — Department of Mathematics, Emory University
Built at Emory University









