Skip to content

quantsingularity/QuantPapers

Repository files navigation

QuantPapers

Self-contained, runnable Jupyter notebooks that walk through the six research papers of the QuantSingularity program. Each notebook implements a paper's core method from scratch, runs it end to end on reproducible synthetic data, and renders publication-quality figures. Every number and figure is computed live in the notebook: nothing is hard-coded or fabricated.

These notebooks are the companion, transparent view of the six full research repositories. Where those repositories are production-grade packages with test suites and pipelines, the notebooks here are single-file, top-to-bottom walkthroughs meant to show clearly what each paper is doing.

Author: Abrar Ahmed, QuantSingularity Research Institute (research@quantsingularity.org)

Notebooks

Notebook Paper Stack Figures
Paper1_CBDC-Quantum.ipynb Quantum-enhanced deep RL for CBDC liquidity optimization PennyLane, NumPy 5
Paper2_DRL-Portfolio.ipynb Deep RL for portfolio optimization (PPO, SAC) Stable-Baselines3, Gymnasium 5
Paper3_HFT-Spoofing.ipynb Deep learning for HFT microstructure spoofing detection PyTorch 5
Paper4_XAI-Volatility.ipynb Explainable deep learning for volatility forecasting TensorFlow, SHAP 6
Paper5_GE-LSTM-Attn.ipynb Graph-enhanced LSTM-attention for volatility and contagion NumPy, SciPy, scikit-learn 7
Paper6_QGRL.ipynb Quantum graph RL for CBDC systemic risk management NumPy, SciPy 7

What each notebook covers

Paper 1: Quantum-Enhanced Deep RL for CBDC Liquidity Optimization. A central-bank liquidity environment with stochastic flows, a stress process, and a Basel III Liquidity Coverage Ratio constraint. A 4-qubit data-reuploading variational quantum circuit (built and drawn in PennyLane) drives a hybrid quantum-classical policy, compared against a matched classical baseline, both trained by REINFORCE.

Paper 2: Deep RL for Portfolio Optimization. A custom Gymnasium trading environment with proportional transaction costs and a long-only capped-simplex constraint. PPO and SAC agents from Stable-Baselines3 are trained and backtested out of sample against equal-weight and volatility-timing benchmarks, with Sharpe, Sortino, drawdown, and turnover.

Paper 3: Deep Learning for HFT Spoofing Detection. A simulated limit order book with injected spoofing episodes, ten microstructure features, and a PyTorch temporal transformer with an adaptive positional encoding. Evaluation uses precision-recall (appropriate for rare events), a confusion matrix, a threshold sweep, and self-attention diagnostics.

Paper 4: Explainable Deep Learning for Volatility Forecasting. A two-headed TensorFlow LSTM-attention network trained on a joint MSE and pinball (quantile) objective, with a Value-at-Risk backtest, learned attention profiles, and SHAP feature and temporal attributions.

Paper 5: Graph-Enhanced LSTM-Attention for Volatility and Contagion. A pure-NumPy build of the full framework: crisis-regime market data, leak-free features, Bayesian online change-point detection, a three-edge dynamic contagion graph, a multi-task model trained by exact head fitting plus SPSA, classical baselines (GARCH, HAR-RV, gradient boosting), VaR backtests, Diebold-Mariano tests, and GraphSHAP explainability.

Paper 6: Quantum Graph RL for CBDC Systemic Risk Management. A pure-NumPy build of the multi-agent system: an exact statevector simulator of an 8-qubit variational circuit, the parameter-shift rule verified against finite differences, a barren-plateau diagnostic, a quantum graph neural network, QGRL trained against baselines that also genuinely learn, a Lemma 1 Pareto verification, and policy explainability.

Scope and honesty notes

  • Quantum notebooks are classical simulation. In Papers 1 and 6, every "quantum" computation is an exact classical statevector simulation of a variational circuit. No quantum hardware is used and no quantum speedup is claimed. The circuits are genuine; the execution is simulated.
  • Demo scale, not paper scale. Training runs use small models and short budgets so each notebook completes in minutes on a CPU. The reported metrics reflect these specific short runs and are not the papers' full-scale headline numbers. The purpose here is a transparent, reproducible view of each method, not a reproduction of best-case results on a laptop.
  • No fabricated results. Every figure and metric is computed at run time from the code in the notebook. There are no hard-coded tables or synthetic "improvement" multipliers anywhere.

Requirements

A recent Python (3.10 or newer) with Jupyter. Common to all notebooks:

numpy
scipy
pandas
matplotlib
scikit-learn
jupyter

Per-notebook extras:

Paper 1  ->  pennylane
Paper 2  ->  stable-baselines3  gymnasium
Paper 3  ->  torch
Paper 4  ->  tensorflow  shap
Paper 5  ->  (common stack only)
Paper 6  ->  (common stack only)

Install the common stack plus whichever extras you need, for example:

pip install numpy scipy pandas matplotlib scikit-learn jupyter
pip install pennylane                      # for Paper 1
pip install stable-baselines3 gymnasium    # for Paper 2
pip install torch                          # for Paper 3
pip install tensorflow shap                # for Paper 4

Running

Open any notebook and run all cells top to bottom:

jupyter notebook Paper5_GE-LSTM-Attn.ipynb

Each notebook is fully self-contained: it generates its own data, defines its own models, trains, evaluates, and plots, with no dependency on external files or on the companion research repositories. The notebooks in this repository ship with their outputs already executed, so the figures are visible without running anything.

Papers 5 and 6 need only the common stack and run in a couple of minutes. Papers 1 through 4 pull in their respective deep-learning or quantum frameworks and take a few minutes each on a CPU.

Companion repositories

Each notebook corresponds to a full research repository containing the production implementation, test suite, and reproducibility pipeline. See the author's profile for the six paper repositories.

License

MIT.

About

Self-contained notebooks for six quant finance papers on quantum RL, deep RL portfolios, HFT spoofing, and XAI models.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors