# nl2992/fourier-option-pricer architecture

> Architecture diagram of the GitHub repository nl2992/fourier-option-pricer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nl2992/fourier-option-pricer
- Repository: https://github.com/nl2992/fourier-option-pricer

## Overview

fourier-option-pricer is a Python derivatives-pricing library centered on characteristic-function models and a unified pricing dispatcher. Users provide market inputs, model parameters, strikes or a product, and an engine; pricing methods return option values, while calibration and implied-volatility tools support quote analysis. Its documented scope also includes exotic products, Monte Carlo and non-Fourier baselines, two-asset options, and volatility-surface workflows. Some branches are documented but unsampled, so their internal connections are omitted rather than inferred.

Main entry points: [`foureng/pipeline.py`](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pipeline.py) (Pricing pipeline), [`foureng/pricers/cos.py`](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/cos.py) (COS pricing), [`foureng/models`](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/models) (Model families), [`foureng/models/registry.py`](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/registry.py) (Model registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Models and CFs"]
  node_market["Market inputs<br/>[base.py]"]
  node_registry["Model registry<br/>[registry.py]"]
  node_model_impl["Model families"]
  node_pyfeng["PyFENG backend<br/>[_pyfeng_backend.py]"]
end

subgraph group_engines["Pricing engines"]
  node_dispatch["Pricing pipeline<br/>[pipeline.py]"]
  node_cos["COS pricing<br/>[cos.py]"]
  node_cos_ctmc["COS variance chain<br/>[cos_ctmc.py]"]
  node_proj["PROJ pricing<br/>[proj.py]"]
  node_other_engines["Fourier engines"]
  node_mc["Monte Carlo<br/>[engine.py]"]
end

subgraph group_products["Products and exotics"]
  node_products["Product specifications"]
  node_two_asset["Two-asset products<br/>[multi_asset.py]"]
  node_analytics["Analytic exotics"]
end

subgraph group_analysis["Calibration and analysis"]
  node_surface["Volatility surfaces"]
  node_calibration["Model calibration"]
  node_implied_vol["Implied volatility"]
  node_greeks["COS Greeks<br/>[cos_greeks.py]"]
end

subgraph group_support["Numerical support"]
  node_cumulants["Cumulant tools<br/>[cumulants.py]"]
  node_grids["Pricing grids<br/>[grids.py]"]
  node_filters["Spectral filters"]
end

node_user(("Pricing user"))
node_result["Option prices"]

node_user -->|"submits request"| node_dispatch
node_market -->|"supplies inputs"| node_dispatch
node_registry -->|"selects model"| node_dispatch
node_registry -->|"registers models"| node_model_impl
node_model_impl -->|"uses backend"| node_pyfeng
node_dispatch -->|"dispatches pricing"| node_cos
node_dispatch -->|"dispatches pricing"| node_cos_ctmc
node_dispatch -->|"dispatches pricing"| node_proj
node_dispatch -->|"dispatches pricing"| node_other_engines
node_dispatch -->|"dispatches pricing"| node_mc
node_dispatch -->|"prices products"| node_products
node_dispatch -->|"routes options"| node_two_asset
node_dispatch -->|"uses analytic routes"| node_analytics
node_dispatch -->|"returns prices"| node_result
node_cos -->|"computes bounds"| node_cumulants
node_cos -->|"uses grids"| node_grids
node_cos -->|"applies filters"| node_filters
node_calibration -->|"fits parameters"| node_model_impl
node_calibration -->|"fits surface"| node_surface
node_greeks -->|"uses pricing method"| node_cos
node_user -->|"inverts quotes"| node_implied_vol

click node_market "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/base.py"
click node_registry "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/registry.py"
click node_model_impl "https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/models"
click node_pyfeng "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/_pyfeng_backend.py"
click node_dispatch "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pipeline.py"
click node_cos "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/cos.py"
click node_cos_ctmc "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/cos_ctmc.py"
click node_proj "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/proj.py"
click node_other_engines "https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/pricers"
click node_mc "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/mc/engine.py"
click node_products "https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/products"
click node_two_asset "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/products/multi_asset.py"
click node_analytics "https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/analytics"
click node_surface "https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/surface"
click node_calibration "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/surface/model_calibration.py"
click node_implied_vol "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/iv/lets_be_rational.py"
click node_greeks "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/greeks/cos_greeks.py"
click node_cumulants "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/cumulants.py"
click node_grids "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/grids.py"
click node_filters "https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/spectral_filters.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_market,node_registry,node_model_impl,node_pyfeng,node_user toneBlue
class node_dispatch,node_cos,node_cos_ctmc,node_proj,node_other_engines,node_mc toneAmber
class node_products,node_two_asset,node_analytics toneMint
class node_surface,node_calibration,node_implied_vol,node_greeks toneRose
class node_cumulants,node_grids,node_filters,node_result toneIndigo
```

## Components

### Models and CFs

- [Market inputs](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/base.py): `foureng/models/base.py`
- [Model registry](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/registry.py): `foureng/models/registry.py`
- [Model families](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/models): `foureng/models`
- [PyFENG backend](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/models/_pyfeng_backend.py): `foureng/models/_pyfeng_backend.py`

### Pricing engines

- [Pricing pipeline](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pipeline.py): `foureng/pipeline.py`
- [COS pricing](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/cos.py): `foureng/pricers/cos.py`
- [COS variance chain](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/cos_ctmc.py): `foureng/pricers/cos_ctmc.py`
- [PROJ pricing](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/pricers/proj.py): `foureng/pricers/proj.py`
- [Fourier engines](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/pricers): `foureng/pricers`
- [Monte Carlo](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/mc/engine.py): `foureng/mc/engine.py`

### Products and exotics

- [Product specifications](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/products): `foureng/products`
- [Two-asset products](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/products/multi_asset.py): `foureng/products/multi_asset.py`
- [Analytic exotics](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/analytics): `foureng/analytics`

### Calibration and analysis

- [Volatility surfaces](https://github.com/nl2992/fourier-option-pricer/tree/main/foureng/surface): `foureng/surface`
- [Model calibration](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/surface/model_calibration.py): `foureng/surface/model_calibration.py`
- [Implied volatility](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/iv/lets_be_rational.py): `foureng/iv/lets_be_rational.py`
- [COS Greeks](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/greeks/cos_greeks.py): `foureng/greeks/cos_greeks.py`

### Numerical support

- [Cumulant tools](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/cumulants.py): `foureng/utils/cumulants.py`
- [Pricing grids](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/grids.py): `foureng/utils/grids.py`
- [Spectral filters](https://github.com/nl2992/fourier-option-pricer/blob/main/foureng/utils/spectral_filters.py): `foureng/utils/spectral_filters.py`

### Other components

- **Pricing user**
- **Option prices**

## Connections

- Pricing user → Pricing pipeline: submits request (evidence: `README.md`)
- Market inputs → Pricing pipeline: supplies inputs (evidence: `README.md`)
- Model registry → Pricing pipeline: selects model (evidence: `foureng/pipeline.py`)
- Model registry → Model families: registers models (evidence: `foureng/models/registry.py`)
- Model families → PyFENG backend: uses backend (evidence: `foureng/models/bsm.py`)
- Pricing pipeline → COS pricing: dispatches pricing (evidence: `foureng/pipeline.py`)
- Pricing pipeline → COS variance chain: dispatches pricing (evidence: `foureng/pipeline.py`)
- Pricing pipeline → PROJ pricing: dispatches pricing (evidence: `foureng/pipeline.py`)
- Pricing pipeline → Fourier engines: dispatches pricing (evidence: `foureng/pipeline.py`)
- Pricing pipeline → Monte Carlo: dispatches pricing (evidence: `foureng/pipeline.py`)
- Pricing pipeline → Product specifications: prices products (evidence: `README.md`)
- Pricing pipeline → Two-asset products: routes options (evidence: `README.md`)
- Pricing pipeline → Analytic exotics: uses analytic routes (evidence: `foureng/pipeline.py`)
- Pricing pipeline → Option prices: returns prices (evidence: `foureng/pipeline.py`)
- COS pricing → Cumulant tools: computes bounds (evidence: `foureng/pricers/cos.py`)
- COS pricing → Pricing grids: uses grids (evidence: `foureng/pricers/cos.py`)
- COS pricing → Spectral filters: applies filters (evidence: `foureng/pricers/cos.py`)
- Model calibration → Model families: fits parameters (evidence: `foureng/surface/model_calibration.py`)
- Model calibration → Volatility surfaces: fits surface (evidence: `foureng/surface/calibration.py`)
- COS Greeks → COS pricing: uses pricing method (evidence: `foureng/greeks/cos_greeks.py`)
- Pricing user → Implied volatility: inverts quotes (evidence: `README.md`)
