Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .claude/skills/update-doc-indexes/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: update-doc-indexes
description: Update top level API index pages with missing documented pages and classes
---

# Update API index pages

Update every top level API index page so it references all the relevant
documented pages and classes of its section.

## Scope

The top level index pages are `docs/api/<section>/index.md`, one per section
listed under `API Reference` in the `nav` of `mkdocs.yml`
(currently: data, dists, options, rates, sp, ta, utils).
If arguments name one or more sections, restrict the update to those.

## Procedure

For each section:

1. Read the section entry in the `nav` of `mkdocs.yml` and list its pages.
2. For each page, collect what it documents: the H1 title and the
mkdocstrings entries (`::: fully.qualified.path` lines).
3. Read the section `index.md` and identify pages or classes that are not
mentioned anywhere on it.
4. Add the missing entries to the index page:
* Follow the existing layout of that index page. If it uses tables with
`| Class | Description |` columns, extend or add tables in the same
format. Only introduce a new H2 section when the missing entries do not
fit an existing one, and match the style of the sections already there.
* Ask the developer where to place a new section if the page layout does
not make the placement obvious.
* Link classes and functions with mkdocstrings cross-references
(`[ClassName][fully.qualified.path]`) and pages with relative markdown
links (e.g. `[SVI Volatility Smile](svi.md)`).
* Write a one line description for each entry, based on the docstring or
the page introduction. Link concepts to `docs/glossary.md` instead of
redefining them.
5. Do not remove or rewrite existing content: this skill only adds what is
missing and fixes references that are broken.

## Conventions

* Follow the documentation rules in `.github/copilot-instructions.md`
(no dashes as punctuation, short paragraphs, relative links).
* Do not edit generated files (`docs/bibliography.md`, `readme.md`).
* After the update, list for the developer which entries were added to which
index page.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ help:
@echo ================================================================================

.PHONY: app-serve
app-serve: ## serve app
app-serve: ## serve python api app only
@MICRO_SERVICE_HOST=127.0.0.1 uv run python -m app

.PHONY: docs
Expand All @@ -25,7 +25,7 @@ docs-examples: ## Regenerate docs examples

.PHONY: docs-serve
docs-serve: ## serve docs, examples, and API with auto-reload
@bash ./dev/docs-serve
@bash ./dev/serve/all

.PHONY: frontend-build
frontend-build: ## build Observable frontend examples
Expand All @@ -34,7 +34,7 @@ frontend-build: ## build Observable frontend examples

.PHONY: frontend-serve
frontend-serve: ## serve Observable frontend with auto-reload
@bash ./dev/frontend-serve
@bash ./dev/serve/observable

.PHONY: install-dev
install-dev: ## Install development dependencies
Expand Down
2 changes: 1 addition & 1 deletion app/api/volatility.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ForwardCurveResponse(BaseModel):


class VolSurfaceResponse(BaseModel):
ssvi: SSVI = Field(description="SSVI model fitted to the volatility surface")
ssvi: SSVI = Field(description="eSSVI model fitted to the volatility surface")
inputs: VolSurfaceInputs = Field(description="Volatility surface inputs")
options: list[OptionInfo] = Field(
description="List of option info with implied volatilities"
Expand Down
16 changes: 0 additions & 16 deletions dev/docs-serve

This file was deleted.

8 changes: 0 additions & 8 deletions dev/frontend-serve

This file was deleted.

12 changes: 0 additions & 12 deletions dev/mkdocs-serve

This file was deleted.

10 changes: 0 additions & 10 deletions dev/serve-info

This file was deleted.

18 changes: 18 additions & 0 deletions dev/serve/all
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e

QUANTFLOW_OBSERVABLE_PORT=${QUANTFLOW_OBSERVABLE_PORT:-8006}
QUANTFLOW_MKDOCS_PORT=${QUANTFLOW_MKDOCS_PORT:-8000}
QUANTFLOW_API_PORT=${QUANTFLOW_API_PORT:-8001}

QUANTFLOW_OBSERVABLE_URL=${QUANTFLOW_OBSERVABLE_URL:-http://127.0.0.1:${QUANTFLOW_OBSERVABLE_PORT}}
QUANTFLOW_MKDOCS_ORIGIN=${QUANTFLOW_MKDOCS_ORIGIN:-http://127.0.0.1:${QUANTFLOW_MKDOCS_PORT}}
QUANTFLOW_API_ORIGIN=${QUANTFLOW_API_ORIGIN:-http://127.0.0.1:${QUANTFLOW_API_PORT}}

npm --prefix frontend exec concurrently -- \
--kill-others \
--names mkdocs,observable,api \
--prefix "[{name}]" \
"QUANTFLOW_MKDOCS_PORT=${QUANTFLOW_MKDOCS_PORT} QUANTFLOW_OBSERVABLE_URL=${QUANTFLOW_OBSERVABLE_URL} bash ./dev/serve/mkdocs" \
"QUANTFLOW_OBSERVABLE_PORT=${QUANTFLOW_OBSERVABLE_PORT} QUANTFLOW_API_ORIGIN=${QUANTFLOW_API_ORIGIN} QUANTFLOW_MKDOCS_ORIGIN=${QUANTFLOW_MKDOCS_ORIGIN} bash ./dev/serve/observable" \
"QUANTFLOW_API_PORT=${QUANTFLOW_API_PORT} QUANTFLOW_CORS_ORIGINS=${QUANTFLOW_OBSERVABLE_URL} bash ./dev/serve/api"
6 changes: 3 additions & 3 deletions dev/api-serve → dev/serve/api
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
set -e

API_PORT=${API_PORT:-8001}
QUANTFLOW_API_PORT=${QUANTFLOW_API_PORT:-8001}

echo "API: http://127.0.0.1:${API_PORT}"
echo "API: http://127.0.0.1:${QUANTFLOW_API_PORT}"

uv run uvicorn \
app.__main__:crate_app \
--factory \
--host 127.0.0.1 \
--port ${API_PORT} \
--port ${QUANTFLOW_API_PORT} \
--reload \
--reload-dir app \
--reload-dir quantflow
12 changes: 12 additions & 0 deletions dev/serve/mkdocs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e

QUANTFLOW_MKDOCS_PORT=${QUANTFLOW_MKDOCS_PORT:-8000}

echo "Documentation: http://127.0.0.1:${QUANTFLOW_MKDOCS_PORT}"

uv run mkdocs serve \
--dev-addr 127.0.0.1:${QUANTFLOW_MKDOCS_PORT} \
--livereload \
--watch quantflow \
--watch docs
12 changes: 12 additions & 0 deletions dev/serve/observable
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e

QUANTFLOW_OBSERVABLE_PORT=${QUANTFLOW_OBSERVABLE_PORT:-8006}

echo "Examples: http://127.0.0.1:${QUANTFLOW_OBSERVABLE_PORT}"

npm --prefix frontend \
run dev \
-- \
--host 127.0.0.1 \
--port ${QUANTFLOW_OBSERVABLE_PORT}
18 changes: 18 additions & 0 deletions docs/api/dists/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@ stochastic process at a fixed time horizon.
Every distribution derives from
[Distribution][quantflow.dists.Distribution], which exposes a common
[sample][quantflow.dists.Distribution.sample] method for drawing random variates.

The [1D Distributions](distributions1d.md) page documents
[Distribution1D][quantflow.dists.Distribution1D] and its concrete laws
[Normal][quantflow.dists.Normal], [Exponential][quantflow.dists.Exponential]
and [DoubleExponential][quantflow.dists.DoubleExponential], used as jump size
distributions in compound Poisson processes.

Multivariate laws derive from [MvDistribution][quantflow.dists.MvDistribution],
which exposes its [MeanAndCov][quantflow.dists.MeanAndCov] statistics;
[MvNormal][quantflow.dists.MvNormal] is the multivariate normal implementation,
documented on the [Distributions](distributions.md) page.

[Marginal1D][quantflow.dists.Marginal1D], on the [Marginal 1D](marginal1d.md)
page, is the abstract 1D distribution with Fourier based option pricing.
The pricing method is selected via
[OptionPricingMethod][quantflow.dists.OptionPricingMethod] and results are
returned as [OptionPricingResult][quantflow.dists.OptionPricingResult] or
[OptionPricingCosResult][quantflow.dists.OptionPricingCosResult].
2 changes: 1 addition & 1 deletion docs/api/options/black.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here we define the [log strike](../../glossary.md#log-strike) `k` as
k = \log{\frac{K}{F_\tau}}
\end{equation}

where $K$ is the strike price and $F_\tau$ is the forward price of the underlying asset at time to maturity $\tau$.
where $K$ is the strike price and $F_\tau$ is the [forward price](../../glossary.md#forwards) of the underlying asset at time to maturity $\tau$.


::: quantflow.options.bs.black_price
Expand Down
11 changes: 7 additions & 4 deletions docs/api/options/divfm.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Deep IV Factor Model

The DIVFM module implements the Deep Implied Volatility Factor Model from
Gauthier, Godin & Legros (2025). The IV surface on a given day is modelled as
[Gauthier, Godin & Legros (2025)](../../bibliography.md#gauthier).
The IV surface on a given day is modelled as
a linear combination of $p$ fixed latent functions learned by a neural network:

$$\sigma_t(M, \tau; \theta) = \mathbf{f}(M, \tau, X; \theta)\,\boldsymbol{\beta}_t = \sum_{i=1}^{p} \beta_{t,i}\,f_i(M, \tau, X; \theta)$$
\begin{equation}
\sigma_t(M, \tau; \theta) = \mathbf{f}(M, \tau, X; \theta)\,\boldsymbol{\beta}_t = \sum_{i=1}^{p} \beta_{t,i}\,f_i(M, \tau, X; \theta)
\end{equation}

where $M = \frac{1}{\sqrt{\tau}}\log\!\left(\frac{K}{F_{t,\tau}}\right)$ is the
time-scaled moneyness, $\mathbf{f}$ is a feedforward neural network with fixed
where $M$ is the time-scaled [moneyness](../../glossary.md#moneyness),
$\mathbf{f}$ is a feedforward neural network with fixed
weights $\theta$ shared across all days, and $\boldsymbol{\beta}_t$ are daily
coefficients fitted in closed form via OLS.

Expand Down
17 changes: 16 additions & 1 deletion docs/api/options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,26 @@ which accepts price inputs incrementally and builds the surface through its `sur
The lower-level [GenericVolSurfaceLoader][quantflow.options.surface.GenericVolSurfaceLoader]
provides the same functionality with a user-defined security type.

## Pricing

| Class | Description |
|---|---|
| [black_price][quantflow.options.bs.black_price] | Undiscounted Black call/put prices in [forward space](../../glossary.md#forward-space) |
| [BlackSensitivities][quantflow.options.bs.BlackSensitivities] | Black model sensitivities (Greeks) in forward space |
| [implied_black_volatility][quantflow.options.bs.implied_black_volatility] | Implied Black volatility via Newton's method |
| [SVI][quantflow.options.svi.SVI] | SVI parameterisation of a single-maturity volatility smile |
| [SSVI][quantflow.options.ssvi.SSVI] | SSVI parameterisation of the full volatility surface |
| [DIVFMPricer][quantflow.options.divfm.DIVFMPricer] | Deep Implied Volatility Factor Model pricer |
| [OptionPricer][quantflow.options.pricer.OptionPricer] | Option pricing with stochastic process models |
| [VolModelCalibration][quantflow.options.calibration.base.VolModelCalibration] | Base class for calibrating vol models (Heston and BNS variants) to a surface |
| [PutCallParity][quantflow.options.parity.PutCallParity] | [Put-call parity](../../glossary.md#put-call-parity) relationships between calls, puts and forwards |
| [moneyness][quantflow.options.moneyness] | Conversions between strike, log-strike and [moneyness](../../glossary.md#moneyness) |

## Price Classes

| Class | Description |
|---|---|
| [Price][quantflow.options.surface.Price] | Base bid/ask price for any security |
| [Price][quantflow.utils.price.Price] | Base bid/ask price for any security |
| [SpotPrice][quantflow.options.surface.SpotPrice] | Spot bid/ask price of an underlying asset |
| [FwdPrice][quantflow.options.surface.FwdPrice] | Forward bid/ask price at a specific maturity |
| [OptionPrice][quantflow.options.surface.OptionPrice] | Single-sided option price with implied volatility and convergence flag |
Expand Down
2 changes: 0 additions & 2 deletions docs/api/options/ssvi.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# SSVI Volatility Surface

::: quantflow.options.ssvi.VarianceCurve

::: quantflow.options.ssvi.SSVI
4 changes: 4 additions & 0 deletions docs/api/rates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The central concept is the [discount factor](../../glossary.md#discount-factor)
f(\tau) = -\frac{\partial \ln D_\tau}{\partial \tau}
\end{equation}

The trivial [NoDiscountCurve][quantflow.rates.no_discount.NoDiscountCurve] implementation has zero rates, so its discount factor is always one.

**[Interpolated Curves](interpolated.md)** build the term structure directly from observed zero rates at a set of anchor dates. [InterpolatedLinearCurve][quantflow.rates.interpolated.InterpolatedLinearCurve] interpolates the zero rate piecewise linearly, while [InterpolatedMonotonicCubicCurve][quantflow.rates.interpolated.InterpolatedMonotonicCubicCurve] uses a shape-preserving cubic spline.

**[CIRCurve](cir.md)** is a short-rate term-structure model derived from the Cox-Ingersoll-Ross process, with positive-rate dynamics and closed-form discount factors.
Expand All @@ -21,3 +23,5 @@ The central concept is the [discount factor](../../glossary.md#discount-factor)
**[VasicekCurve](vasicek.md)** is a Gaussian mean-reverting short-rate model with analytical formulas for discount factors and instantaneous forward rates.

**[Calibration](calibration.md)** provides [YieldCurveCalibration][quantflow.rates.calibration.YieldCurveCalibration], the base class for fitting a yield curve to discount factors, and [OptionsDiscountingCalibration][quantflow.rates.calibration.OptionsDiscountingCalibration], which bootstraps asset and quote curves from put-call parity observations.

Each curve model provides its own calibration wrapper: [InterpolatedYieldCurveCalibration][quantflow.rates.interpolated.InterpolatedYieldCurveCalibration], [CIRCurveCalibration][quantflow.rates.cir.CIRCurveCalibration], [NelsonSiegelCalibration][quantflow.rates.nelson_siegel.NelsonSiegelCalibration] and [VasicekCurveCalibration][quantflow.rates.vasicek.VasicekCurveCalibration].
1 change: 1 addition & 0 deletions docs/api/sp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This page gives an overview of all stochastic processes available in the library

| Process | Description |
|---|---|
| [PoissonBase][quantflow.sp.poisson.PoissonBase] | Abstract base for Poisson-style jump processes |
| [PoissonProcess][quantflow.sp.poisson.PoissonProcess] | Homogeneous Poisson process |
| [CompoundPoissonProcess][quantflow.sp.poisson.CompoundPoissonProcess] | Poisson process with random jump sizes |
| [DSP][quantflow.sp.dsp.DSP] | Doubly stochastic (Cox) Poisson process |
Expand Down
6 changes: 5 additions & 1 deletion docs/api/ta/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Timeseries Analysis

- [Kalman Filter & UKF](kalman.md) — linear-Gaussian and unscented filtering
- [EWMA](ewma.md): exponentially weighted moving average filter for time series
- [Kalman Filter & UKF](kalman.md): linear-Gaussian and unscented filtering
- [OHLC](ohlc.md): OHLC bar aggregation with range-based variance estimators
- [Paths](paths.md): paths produced by stochastic process simulations
- [Supersmoother](supersmoother.md): two-pole Butterworth filter with adaptive smoothing
1 change: 1 addition & 0 deletions docs/api/utils/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ users who want to extend the library or understand its inner workings.
|---|---|
| [Bins](bins.md) | Histogram and event-density utilities |
| [Numbers](numbers.md) | Decimal number helpers |
| [Price](price.md) | Bid/ask price and price/volume containers |
| [Types](types.md) | Shared type aliases (FloatArray, etc.) |
24 changes: 24 additions & 0 deletions docs/bibliography.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ Jim Gatheral. (2004) [A parsimonious arbitrage-free implied volatility parameter

<div class="bib-entry" markdown>

#### gauthier

Geneviève Gauthier, Frédéric Godin, Sebastien Legros. (2025) [Deep Implied Volatility Factor Models for Stock Options](https://dx.doi.org/10.2139/ssrn.5283770){target="_blank" rel="noopener"}

</div>

<div class="bib-entry" markdown>

#### hendriks_martini

Sebas Hendriks, Claude Martini. (2019) [The extended SSVI volatility surface](https://dx.doi.org/10.2139/ssrn.2971502){target="_blank" rel="noopener"}, Journal of Computational Finance, 22(5):25-39

</div>

<div class="bib-entry" markdown>

#### heston-calibration

Milan Mrázek, Jan Pospíšil. (2017) [Calibration and simulation of Heston model](https://doi.org/10.1515/math-2017-0058){target="_blank" rel="noopener"}, Open Mathematics, 15(1):679-704
Expand Down Expand Up @@ -174,6 +190,14 @@ G. K. G. Saez. (2014) [Fourier Transform Methods for Option Pricing: An Applicat

<div class="bib-entry" markdown>

#### ssvi_calibration

Pierre Cohort, Jacopo Corbetta, Claude Martini, Ismail Laachir. (2019) [Robust calibration and arbitrage-free interpolation of SSVI slices](https://doi.org/10.48550/arXiv.1804.04924){target="_blank" rel="noopener"}, Decisions in Economics and Finance, 42(2)

</div>

<div class="bib-entry" markdown>

#### ukf

Merwe. (2014) [The Unscented Kalman Filter for Nonlinear Estimation](https://groups.seas.harvard.edu/courses/cs281/papers/unscented.pdf){target="_blank" rel="noopener"}, internet
Expand Down
Loading
Loading