Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Quantflow’s volatility-surface stack by migrating the SSVI implementation to an eSSVI (per-maturity
Changes:
- Reworked
quantflow.options.ssvi.SSVIinto an eSSVI node-based model with slice-by-slice “star” calibration and explicit calendar + butterfly arbitrage checks. - Refreshed docs and examples (mkdocs API pages, glossary/bibliography entries, Observable “volatility surface” page) to match eSSVI and updated notation.
- Refactored local serve scripts and frontend configuration to support configurable API and docs origins.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| quantflow/utils/numbers.py | Adds documentation around DecimalNumber JSON schema typing (needs adjustment, see comments). |
| quantflow/options/surface.py | Tweaks VolSurface docstring formatting (introduces a Markdown heading in a docstring). |
| quantflow/options/ssvi.py | Major rewrite to eSSVI with per-node parameters, interpolation, and new calibration routine. |
| quantflow/options/divfm/weights.py | Improves math notation and adds Annotated[..., Doc(...)] parameter docs. |
| quantflow/options/divfm/trainer.py | Updates docstrings and bibliography link formatting for DIVFM trainer docs. |
| quantflow/options/divfm/pricer.py | Improves math/docs and adds Annotated[..., Doc(...)] parameter docs for calibrate. |
| quantflow/options/divfm/network.py | Updates math block formatting and clarifies factor-function documentation. |
| quantflow/options/bs.py | Corrects/clarifies Greek formulas in docs and fixes volga/vanna scaling to divide by iv. |
| quantflow_tests/test_ssvi.py | Updates tests to the new eSSVI node model and calibration behavior. |
| quantflow_tests/test_options.py | Adds finite-difference regression test for Black sensitivities. |
| mkdocs.yml | Makes “Live Examples” URL configurable via environment, and updates nav accordingly. |
| Makefile | Updates serve targets to use the new dev/serve/* scripts. |
| frontend/src/volatility-surface.md | Updates the Observable example to consume and visualize eSSVI node parameters. |
| frontend/src/lib/api.ts | Adds mkdocsOrigin() for configurable docs links in the frontend. |
| frontend/src/index.md | Adds a link from examples to the main mkdocs documentation origin. |
| frontend/package.json | Simplifies dev script (host/port now passed by wrapper scripts). |
| frontend/observablehq.config.js | Injects mkdocs origin meta tag and uses it for header assets/links. |
| docs/references.bib | Adds bibliography entries for DIVFM and eSSVI calibration references. |
| docs/glossary.md | Adds “Moneyness Convexity Adjusted” and “Standard Normal Distribution” glossary entries. |
| docs/bibliography.md | Adds rendered bibliography entries matching the new references. |
| docs/api/utils/index.md | Adds missing “Price” page entry to the utils API index. |
| docs/api/ta/index.md | Expands TA index with additional pages (EWMA, OHLC, Paths, Supersmoother). |
| docs/api/sp/index.md | Adds PoissonBase to the stochastic processes index table. |
| docs/api/rates/index.md | Adds clarifications and references to rate curve implementations/calibrations. |
| docs/api/options/ssvi.md | Removes VarianceCurve from API page and documents SSVI only. |
| docs/api/options/index.md | Adds a “Pricing” section and updates Price crossref target. |
| docs/api/options/divfm.md | Updates formula formatting and links to bibliography/glossary. |
| docs/api/options/black.md | Clarifies forward-price glossary link. |
| docs/api/dists/index.md | Expands distribution index overview and links to related pages/types. |
| dev/serve/observable | New wrapper script to run Observable examples on a fixed host/port. |
| dev/serve/mkdocs | New wrapper script to serve mkdocs on a configurable port. |
| dev/serve/api | Updates API serve script to use QUANTFLOW_API_PORT naming. |
| dev/serve/all | New “serve everything” script using concurrently and consistent env var wiring. |
| dev/serve-info | Removed in favor of the new dev/serve/* scripts. |
| dev/mkdocs-serve | Removed in favor of dev/serve/mkdocs. |
| dev/frontend-serve | Removed in favor of dev/serve/observable. |
| dev/docs-serve | Removed in favor of dev/serve/all. |
| app/api/volatility.py | Updates API response description to “eSSVI model”. |
| .claude/skills/update-doc-indexes/SKILL.md | Adds a documented internal skill for keeping API index pages complete. |
| """Represents a volatility surface, which captures the implied volatility of | ||
| options for different strikes and maturities. | ||
|
|
||
| Key Concepts: | ||
| ## Key Concepts | ||
|
|
||
| * **Implied Volatility:** The market's expectation of future volatility, derived | ||
| from the price of an option using a pricing model (e.g., Black-Scholes). | ||
| from the price of an option using Black-Scholes. |
| DecimalNumber = Annotated[Decimal, WithJsonSchema({"type": "number"})] | ||
| """Add typing number to Pydantic serialization""" |
| if not slices: | ||
| raise ValueError("at least one maturity slice is required") | ||
| data = [] |
| for k, iv, ttm in slices: | ||
| k_arr = np.asarray(k, dtype=float) | ||
| iv_arr = np.asarray(iv, dtype=float) | ||
| if k_arr.size == 0 or iv_arr.size == 0: | ||
| raise ValueError("k and iv must contain at least one quote") |
| "larger values concentrate the fit at the money. " | ||
| "Must be non negative" | ||
| ), | ||
| ] = 0.5, |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #88 +/- ##
==========================================
+ Coverage 88.75% 88.93% +0.17%
==========================================
Files 84 85 +1
Lines 5142 5379 +237
==========================================
+ Hits 4564 4784 +220
- Misses 578 595 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.