quant-portfolio

A flagship, end-to-end quantitative finance portfolio: 10 project areas built twice each — once for equity, once for FX, as fully separate, self-contained codebases — in Python, with C++ and Rust performance twins for the four highest-value pricing and risk engines, plus three standalone foundations projects built from first principles.

Verified, not claimed

Sub-projects                        31 — 10 dual-asset-class areas × 2, 3 foundations projects, 4 engines × 2 languages
Test suite                        6,446 tests, all passing — Python equity 2,350 / FX 2,830 / foundations 554, C++ 326, Rust 386 — reproduced from a clean checkout by CI and by tests/test_docs_counts.py, which recounts every number on this page
Cross-language validation     golden vectors: Python reference → committed JSON → C++ (GoogleTest) → Rust (cargo test), 1e-10 (options) / 1e-9 rel & 1e-6–1e-8 (VaR/ES) tolerance, provenance re-checked by tools/gen_golden_*.py --check in CI
Learning guide                      481 self-test questions across 18 rounds, every answer grounded in the real code
Cookbook                           63 recipes, every snippet actually executed and verified before publishing

The 10 project areas

01

Options Pricing & Greeks

Black-Scholes / Garman-Kohlhagen closed form, analytic and finite-difference Greeks, CRR binomial trees for American exercise, Newton+bisection implied vol, Monte Carlo cross-checks. C++ & Rust twins.

02

Volatility Modeling

GARCH-family forecasting of realized volatility, clustering and mean reversion, forecast validation against a naive benchmark.

03

VaR / Expected Shortfall

Historical, age-weighted, parametric (Cornish-Fisher) and Monte Carlo VaR with full book revaluation; Kupiec/Christoffersen backtesting and Basel traffic-light scoring. C++ & Rust twins.

04

Fixed Income

Bond pricing, yield-to-maturity solving, duration/convexity/DV01, yield curve construction, day-count conventions.

05

Statistical Pairs Trading

Cointegration testing, hedge-ratio estimation, z-score entry/exit, market-neutral spread construction and backtesting.

06

Credit Risk

Probability-of-default modeling, discrimination and calibration validation, expected-loss estimation.

07

Portfolio Optimization

Mean-variance, minimum-variance and risk-parity allocation, constrained optimization, marginal/component risk attribution.

08

Algorithmic Execution

TWAP/VWAP/participation-rate scheduling, market-impact modeling, implementation-shortfall and transaction-cost analysis.

09

Volatility Surfaces

Raw-SVI smile/skew surface construction with Durrleman no-arbitrage checks, Heston stochastic volatility (little-trap characteristic function) with Monte Carlo pricing; SABR is discussed as an alternative, not implemented.

10

Regime-Switching Strategies

Regime detection, regime-conditional signals, walk-forward validation against overfitting to hindsight-obvious regimes.

Foundations & engineering

F1–F3

Foundations trilogy

Single-asset risk metrics, strict no-look-ahead backtest discipline, and a zero-scipy from-scratch Black-Scholes rebuild validated by an independent Monte Carlo pricer.

C++ / Rust

Cross-language engines

Zero-external-dependency C++20 and Rust engines for options/Greeks and VaR/ES, each with its own from-scratch RNG, normal CDF/PPF, and Cholesky factorization — validated against Python golden vectors, not re-derived independently.

Discipline

The documentation contract

Every project answers, in writing: why this model over the alternatives, what assumptions it makes and what breaks if violated, how it was validated, where it fails with reproducible examples, and how a real desk would use it.

Review history

Found and fixed, not hidden

Three portfolio-wide review passes found and fixed a NaN-validation defect class (including, in the third pass, the equity Python VaR backtester itself), an implied-vol solver plateau bug, a Cornish-Fisher grid-resolution bug, and a Monte Carlo VaR standard-error bias — all documented as teaching case studies in the learning guide, with the golden-vector generators committed for every engine.

Quick start

Each block below starts from the clone directory, so any one of them can be pasted on its own.

git clone https://github.com/AshJha0/quant-portfolio && cd quant-portfolio

# any Python project (a fresh venv per project is recommended; the 23 projects
# are separate distributions and pytest works from the project root without
# an install thanks to pythonpath = ["src"])
cd python/equity/01-options-pricing && pip install -e . && pytest -q && python examples/run_pipeline.py
cd quant-portfolio

# a C++ engine (out-of-tree build directory)
cmake -S cpp/equity-options-engine -B build/equity-options-engine && cmake --build build/equity-options-engine -j2 && ctest --test-dir build/equity-options-engine --output-on-failure
cd quant-portfolio

# a Rust engine
cd rust/equity-var-engine && RUSTFLAGS="-D warnings" cargo test --release