Skip to main content

Rough Heston option pricing with a quadratic-implicit fractional Adams predictor-corrector solver.

Project description

rough-heston-qipc

Rough Heston option pricing with a Quadratic-Implicit Fractional Adams Predictor-Corrector solver.

What problem it solves

Rough Heston pricing requires solving a fractional Riccati equation inside a Fourier pricing integral. Standard fractional Adams predictor-corrector methods use an explicit corrector evaluation, which can be sensitive when the nonlinear Riccati term becomes stiff or when the time grid is coarse. This package implements a quadratic-implicit corrector that solves the nonlinear endpoint equation exactly at each Fourier node, while preserving the same overall fractional Adams recursion structure.

The project is designed for a computational finance course project: it provides a reusable Python package, a benchmark baseline, a Colab-ready demo notebook, tests, and GitHub Actions workflows for CI and PyPI publishing.

Installation

After publishing to PyPI:

pip install rough-heston-qipc

For local development from the repository root:

pip install -e ".[dev]"

Quick start

from rough_heston_qipc import RoughHestonModel, RoughHestonParams, timed_price

model = RoughHestonModel(RoughHestonParams())
price = model.calculate(NOuter=50, NInner=500)
print(f"price = {price:.12f}")

price, elapsed = timed_price(NOuter=50, NInner=500)
print(f"price = {price:.12f}, elapsed = {elapsed:.4f} seconds")

params = RoughHestonParams(S0=1.0, K=1.0, alpha=0.6, rho=-0.5, nu=0.05)
custom_model = RoughHestonModel(params)
custom_price = custom_model.calculate(50, 500)
explicit_baseline = custom_model.calculate(50, 500, method="explicit")
print(custom_price)

Method overview

The solver prices a European call option under a rough Heston-style characteristic-function representation. For each Fourier node, it solves a fractional Riccati equation of the form

h(t) = I^alpha F(h)(t),     F(h) = A + B h + C h^2.

The original explicit Adams corrector has the endpoint update

h_{k+1} = G_k + a F(h_{k+1}^P),

where h_{k+1}^P is the predictor and G_k is the historical Adams-Moulton contribution. The new method instead uses

h_{k+1} = G_k + a F(h_{k+1}).

Because F(h) is quadratic, the implicit endpoint equation is a scalar complex quadratic equation:

a C h^2 + (a B - 1) h + (G_k + a A) = 0.

Both roots are computed, and the root closest to the predictor is selected to maintain branch continuity.

API reference

RoughHestonParams

Dataclass containing model and numerical parameters.

Field Type Default Description
S0 float 1.0 Initial stock price
K float 1.0 Strike price
r float 0.0 Risk-free rate
z float 0.4 Initial variance/volatility input used in the source implementation
alpha float 0.6 Fractional roughness parameter
lam float 2.0 Mean-reversion speed
theta float 0.04 Long-term variance level
rho float -0.5 Spot-volatility correlation
nu float 0.05 Vol-of-vol parameter
t float 1.0 Maturity
R float 1.5 Fourier damping parameter
u_lower float 0.0 Lower Fourier integration bound
u_upper float 25.0 Upper Fourier integration bound

RoughHestonModel(params=RoughHestonParams())

Model object that stores one RoughHestonParams instance and exposes pricing through calculate.

RoughHestonModel.calculate(NOuter, NInner, method="quadratic_implicit", return_details=False)

Prices one European call option.

Parameters:

  • NOuter: int - number of Gauss-Legendre nodes for Fourier integration.
  • NInner: int - number of time steps for the fractional Adams recursion. Must be even because Simpson quadrature is used for the final time integral.
  • method: str - solver choice. Use "quadratic_implicit" for the new quadratic-implicit method or "explicit" for the original explicit predictor-corrector baseline.
  • return_details: bool - if True, returns (price, details) instead of only price.

Returns:

  • float if return_details=False.
  • (float, dict) if return_details=True; details include Fourier nodes, weights, Riccati grid values, characteristic-function terms, and the selected method.

Demo notebook

Open In Colab

The notebook contains:

  1. Package installation cell for Colab.
  2. Basic price computation.
  3. Runtime measurement.
  4. Convergence visualisation as NInner increases.
  5. Comparison with the explicit predictor-corrector baseline.

Suggested project experiments

Use the demo notebook or examples/benchmark.py to evaluate:

  1. Convergence in time steps: fix NOuter and vary NInner.
  2. Fourier quadrature convergence: fix NInner and vary NOuter.
  3. Runtime comparison: compare method="quadratic_implicit" and method="explicit" on the same model and grid.
  4. Accuracy-speed tradeoff: use a high-resolution result as a reference and plot absolute error against runtime.
  5. Parameter stress tests: vary alpha, rho, and nu to test robustness under roughness, leverage, and vol-of-vol changes.

Repository structure

rough-heston-qipc/
|-- rough_heston_qipc/
|   |-- __init__.py
|   `-- _core.py
|-- tests/
|   `-- test_rough_heston_qipc.py
|-- notebooks/
|   `-- demo.ipynb
|-- examples/
|   `-- benchmark.py
|-- .github/
|   `-- workflows/
|       |-- ci.yml
|       `-- publish.yml
|-- pyproject.toml
|-- README.md
`-- LICENSE

License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rough_heston_qipc-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rough_heston_qipc-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file rough_heston_qipc-0.1.0.tar.gz.

File metadata

  • Download URL: rough_heston_qipc-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rough_heston_qipc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43cfe0381b3492a53bd7dceb262df6c43ab73d5780d91533184506222ba11f16
MD5 d04b1bfb5ac8c4749108b4429d4949fb
BLAKE2b-256 7ef921b30059aa64e52b7e514f58be85d473a0c332f939f37c5f99164c647676

See more details on using hashes here.

Provenance

The following attestation bundles were made for rough_heston_qipc-0.1.0.tar.gz:

Publisher: publish.yml on soya-git/rough_heston_qipc_project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rough_heston_qipc-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rough_heston_qipc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 680501c43053f7abf3bbcee168d82419dede651e0cb618a737ccb526d0134706
MD5 63930af0b8c57e986ca60cb7f63249a4
BLAKE2b-256 5afbe03544f564be7d69b8f04c8db9ff95e5cba6a9e5bc3c83c78d167e40ede6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rough_heston_qipc-0.1.0-py3-none-any.whl:

Publisher: publish.yml on soya-git/rough_heston_qipc_project

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page