Explainable volatility forecasting and signal intelligence framework
Project description
VolSense: Explainable Volatility Forecasting & Signal Intelligence
VolSense is an end-to-end, explainable volatility forecasting and signal generation framework — blending econometric foundations (GARCH, EGARCH, GJR-GARCH) with deep neural architectures (LSTM, attention, residual heads) to deliver multi-horizon, interpretable volatility insights across global markets.
Overview
VolSense answers a central quant research question:
Can deep learning architectures outperform classical GARCH-style baselines without losing interpretability for traders and risk managers?
To explore this, VolSense introduces a two-tiered architecture:
volsense_core— the research and training pipeline for feature engineering, multi-model learning, evaluation, and explainability.volsense_inference— the deployment layer for real-time forecasting, analytics, and signal generation, complete with an interactive Streamlit dashboard.
Core Components
1️⃣ VolSense_Core — Research & Model Training
A modular experimentation framework supporting both classical and neural volatility models:
| Model | Description |
|---|---|
| ARCHFamily (GARCH, EGARCH, GJR-GARCH) | Econometric baselines for regime calibration and interpretability. |
| BaseLSTM | Single-ticker LSTM with residual & attention heads, designed for temporal precision. |
| GlobalVolForecaster | Multi-ticker shared LSTM with ticker embeddings, horizon-specific heads, and dropout regularization. |
Highlights:
- Configurable
TrainConfigdataclass for all hyperparameters. - Robust checkpointing and bundle serialization.
- Multi-horizon support (
1d,5d,10d). - Regime-wise validation on calm (2013-14), spike (2020-21), and forward (2023-present) periods.
- Integrated evaluation layer (RMSE, MAE, correlation, Durbin–Watson, feature importance).
Two flagship models — v109 (109 tickers) and v509 (507 tickers) — are trained and released as production-ready baselines.
2️⃣ VolSense_Inference — Operational Forecasting & Signals
A portable, production-grade inference layer enabling researchers and traders to run forecasts, analyze analytics, and extract signals on demand.
Modules:
forecast_engine.py— unified inference entrypoint.model_loader.py— loads serialized.pth/.pklcheckpoints.predictor.py— manages scaling, batching, and forecast generation.analytics.py— computes cross-ticker analytics, realized vs predicted correlation, and feature diagnostics.signal_engine.py— transforms forecasts into actionable long/short/neutral signals with sector and regime awareness.dashboard.py— a four-tab Streamlit UI for traders and researchers.
Dashboard Tabs:
| Tab | Function |
|---|---|
| Overview | Realized vs predicted volatility snapshot. |
| Ticker Analytics | Forecast curves, realized overlays, error distributions. |
| Sector View | Heatmaps and top/bottom sector rankings by Z-score. |
| Signal Table | Filterable cross-sectional signal matrix by sector, regime, horizon, or position. |
Data & Feature Engineering
- Automated OHLCV ingestion via Yahoo Finance and
multi_fetch.py. - Unified feature generation with
build_features()ensuring identical transformations for training and inference. - Core features include:
vol_3d,vol_20d,vol_60d,vol_ratio,vol_vol,vol_chgreturn,ret_sq,abs_return,ewma_return_5dbeta_20d,market_stress,skew_5d- Calendar features:
day_of_week,month_sin,month_cos
Explainability
VolSense incorporates a multi-layered explainability suite purpose-built for sequence-based volatility forecasting, ensuring transparency across both features and time:
- Attention heatmaps — visualize where the model “looks” across the past 40-day window, revealing temporal focus patterns for each forecast horizon.
- Feature sensitivity analysis — quantifies how changes in key drivers (e.g.,
abs_return,vol_20d,beta_20d) influence log-volatility forecasts at different horizons (1d,5d,10d). - Temporal sensitivity curves — highlight how recency affects predictive power, showing that recent shocks dominate short-term forecasts while older volatility events fade naturally.
- Cross-horizon explainability — compare how feature importance and attention dynamics evolve from reactive (1-day) to smoothed (10-day) predictions.
- Human-aligned interpretation — findings align with financial intuition: volatility clusters, decays over time, and remains influenced by recent market shocks.
Together, these tools make VolSense not only accurate, but also interpretable — bridging quantitative modeling with human reasoning about market dynamics.
Evaluation
Comprehensive evaluation framework (evaluation.py, metrics.py) featuring:
- RMSE, MAE, correlation, and horizon-specific error tracking.
- Volatility clustering and Durbin–Watson diagnostics.
- Residual distribution and QQ plots for calibration.
- Best/worst ticker identification across horizons.
- Feature importance and prediction–truth correlation analytics.
Deployment & CLI
VolSense provides a lightweight CLI for both training and forecasting:
# Train models
volsense-train --config configs/train_v109.yaml
# Run forecasts
volsense-forecast --model v109 --tickers AAPL,MSFT,SPY
Streamlit Dashboard Preview
Launches an intuitive dashboard providing:
- Real-time forecasts and realized vol tracking.
- Sector heatmaps and Z-score distributions.
- Cross-sectional signal visualization with position, regime, and horizon filters.
- One-click CSV export for further analysis.
Documentation
Full technical documentation is generated via Sphinx and Napoleon, including:
- API references for every core/inference module.
- Notebook-integrated tutorials (
01_data_pipeline→06_explainability). - Architectural diagrams and configuration examples.
Repository Structure
VolSense/ │ ├── volsense_core/ │ ├── cli/ # Training CLI │ ├── data/ # Data fetch + feature engineering │ ├── evaluation/ # Metrics + evaluation │ ├── explainability/ # SHAP & interpretability notebooks │ ├── models/ # LSTM, GARCH, GlobalVolForecaster │ ├── utils/ # Checkpoint utils, scalers │ └── forecaster_core.py # Core trainer entrypoint │ ├── volsense_inference/ │ ├── cli/ # Forecast CLI │ ├── notebooks/ # Dashboard & explainability demos │ ├── analytics.py │ ├── forecast_engine.py │ ├── model_loader.py │ ├── predictor.py │ ├── signal_engine.py │ ├── dashboard.py │ └── sector_mapping.py │ ├── models/ # Trained model bundles (v109, v509) │ ├── notebooks/ # Jupyter notebooks (01–06) │ ├── 01_data_pipeline.ipynb │ ├── 02_model_training.ipynb │ ├── 03_model_inference.ipynb │ ├── 04_signals_and_dashboard.ipynb │ ├── 05_v109_training.ipynb │ └── 06_v109_explainability.ipynb │ ├── docs/ # Sphinx documentation ├── pyproject.toml ├── README.md ├── requirements.txt └── .gitignore
Credits & License
Developed by Rahul Karthik as part of the VolSense Research Framework. Inspired by hybrid econometric-deep learning models in quantitative volatility research.
Licensed under the MIT License. Pull requests, collaborations, and discussions are welcome!
Connect
- 📫 LinkedIn: Rahul Karthik
- 💻 GitHub: github.com/rahulmkarthik
- 🧠 Research Interests: Quantitative Finance · Quantitative Systems Design · Volatility Modeling · Explainable AI
- 🧰 Tech Stack: Python · Matplotlib · NumPy · PyTorch · SHAP · Pandas · Seaborn · Streamlit · Sphinx · yFinance
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file volsense-1.0.0.tar.gz.
File metadata
- Download URL: volsense-1.0.0.tar.gz
- Upload date:
- Size: 80.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d22e7a8c8ef0d3b2b5a78f7f316d6924afa170d5903e370e4f8c70bd165dd39
|
|
| MD5 |
59111ecf1c7f7b4da6bdb8ebf99326c2
|
|
| BLAKE2b-256 |
bc497deb53f863aa9f4810e96f303ffcef70a988685d5ea3ef44e6358de37779
|
File details
Details for the file volsense-1.0.0-py3-none-any.whl.
File metadata
- Download URL: volsense-1.0.0-py3-none-any.whl
- Upload date:
- Size: 83.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ee30965edf9987508941576b414a1f6a2ce228a0a469d36f0f1fdb80d7b3de
|
|
| MD5 |
0a37fa9a34a56b8260ac7390410f8dc2
|
|
| BLAKE2b-256 |
c7f6f4e205056ee68eb0e11ab1006406e1582ae97e74d6009c88bd0568499f84
|