An institutional-style quantitative research platform to model and forecast the implied volatility (IV) surface across strike and expiry dimensions using deep learning.
This project treats volatility as a surface evolution problem, not a single-point prediction problem.
Given historical IV surfaces:
- Input: past
Nsurfaces[time, expiry, strike] - Output: future surface
[expiry, strike]
The system is designed for:
- Volatility smile/skew dynamics
- Term structure shifts
- Regime transitions
- Forecast-vs-market visualization
- ๐ฅ Market Data Ingestion: Pulls options chain snapshots (free default: Yahoo Finance).
- ๐งฎ Pricing & IV Engine: Black-Scholes pricing, Greeks, and robust IV inversion (Newton + Brent fallback).
- ๐บ๏ธ Surface Construction: Strike/expiry grids, interpolation, smoothing, and tensor storage.
- ๐ง Neural Forecasting: LSTM, GRU, CNN-LSTM, Transformer, Autoencoder, Conv3D.
- ๐ Evaluation Stack: RMSE, MAE, directional skew accuracy, cosine surface similarity.
- ๐งช Research Utilities: Regime tagging, feature engineering, notebooks.
- โก Serving Layer: FastAPI endpoints + Streamlit dashboard.
- ๐๏ธ Persistence: SQLAlchemy + SQLite for raw chains, surfaces, forecasts, and metrics.
numpy,pandas,scipy,statsmodelspy_vollib,QuantLibyfinance(default free provider)
PyTorchscikit-learn- Optional tracking:
MLflow
FastAPI+PydanticStreamlitPlotly,Matplotlib,SeabornSQLAlchemy
- Implied Volatility (IV): Volatility implied by market option prices under Black-Scholes.
- Smile / Skew: Cross-strike IV shape and directional slope.
- Term Structure: How IV changes across maturities.
- Moneyness: Relative strike/spot relationship (
K/Sorlog(K/S)). - Risk-Neutral Pricing: Pricing under a measure where discounted prices are martingales.
- Greeks: Sensitivities (
delta,gamma,theta,vega,rho).
Neural-Volatility-Surface-Forecaster/
โโโ data/
โ โโโ raw/
โ โโโ processed/
โ โโโ cached/
โโโ notebooks/
โโโ configs/
โโโ src/
โ โโโ ingestion/
โ โโโ pricing/
โ โโโ iv_surface/
โ โโโ preprocessing/
โ โโโ features/
โ โโโ datasets/
โ โโโ models/
โ โโโ training/
โ โโโ evaluation/
โ โโโ visualization/
โ โโโ api/
โ โโโ database/
โ โโโ utils/
โโโ dashboard/
โโโ tests/
โโโ docker/
โโโ requirements.txt
โโโ main.py
โโโ README.mdflowchart LR
A["Options Data Provider"] --> B["Ingestion + Cache"]
B --> C["IV Engine (Newton + Brent)"]
C --> D["Surface Builder (Grid + Interpolation + Smoothing)"]
D --> E["Surface Tensor Store [T,E,K]"]
E --> F["Model Training (LSTM/GRU/CNN-LSTM/Transformer/AE/Conv3D)"]
F --> G["Forecast Surface"]
F --> H["Evaluation Metrics"]
D --> I["SQLite via SQLAlchemy"]
G --> I
H --> I
I --> J["FastAPI"]
I --> K["Streamlit Dashboard"]
- Latest contract rows (strike, bid/ask, volume, OI, IV, Greeks).
- Quick market snapshot (contracts count + median IV).
- Interactive 3D surface and 2D heatmap.
- View smile/skew/term-structure shape in one place.
- Animated IV surface evolution over time.
- Great for spotting shock regimes and deformation patterns.
- Latest predicted surface from trained model.
- Term-structure slice compare: predicted vs actual.
- Stored run metrics over time.
- RMSE/MAE trend chart for tracking model quality.
- Surface feature panel (level/skew/curvature/slope/shock proxy).
- Cluster-based regime labels and distribution.
git clone https://github.com/aryannverse/Neural-Volatility-Surface-Forecaster.git
cd Neural-Volatility-Surface-Forecasterpython3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython main.pypython main.py ingest --ticker SPY
python main.py ingest --ticker SPY --backfill-days 40 --frequency 1Dpython main.py train --ticker SPY --model transformer --lookback 20 --horizon 1 --epochs 30 --batch-size 32python main.py api
python main.py dashboardGET /surface/current/{ticker}GET /surface/history/{ticker}GET /forecast/{ticker}POST /trainWS /ws/forecast/{ticker}
Swagger:
http://localhost:8000/docs
- Yahoo Finance (
yfinance)
- Polygon
- Alpaca
PYTHONPATH=. pytest -q- Arbitrage-constrained training losses
- Uncertainty-aware forecasts
- Regime-conditioned model ensembles
- Cross-asset transfer learning
- Volatility strategy overlays
Built with focus, curiosity, and quant obsession by aryannverse โก