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- ifTrue, returns(price, details)instead of onlyprice.
Returns:
floatifreturn_details=False.(float, dict)ifreturn_details=True; details include Fourier nodes, weights, Riccati grid values, characteristic-function terms, and the selected method.
Demo notebook
The notebook contains:
- Package installation cell for Colab.
- Basic price computation.
- Runtime measurement.
- Convergence visualisation as
NInnerincreases. - Comparison with the explicit predictor-corrector baseline.
Suggested project experiments
Use the demo notebook or examples/benchmark.py to evaluate:
- Convergence in time steps: fix
NOuterand varyNInner. - Fourier quadrature convergence: fix
NInnerand varyNOuter. - Runtime comparison: compare
method="quadratic_implicit"andmethod="explicit"on the same model and grid. - Accuracy-speed tradeoff: use a high-resolution result as a reference and plot absolute error against runtime.
- Parameter stress tests: vary
alpha,rho, andnuto 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43cfe0381b3492a53bd7dceb262df6c43ab73d5780d91533184506222ba11f16
|
|
| MD5 |
d04b1bfb5ac8c4749108b4429d4949fb
|
|
| BLAKE2b-256 |
7ef921b30059aa64e52b7e514f58be85d473a0c332f939f37c5f99164c647676
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rough_heston_qipc-0.1.0.tar.gz -
Subject digest:
43cfe0381b3492a53bd7dceb262df6c43ab73d5780d91533184506222ba11f16 - Sigstore transparency entry: 1367621475
- Sigstore integration time:
-
Permalink:
soya-git/rough_heston_qipc_project@5b9dc710836bee42c13f7ff844946bcb87d187dd -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/soya-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b9dc710836bee42c13f7ff844946bcb87d187dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file rough_heston_qipc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rough_heston_qipc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
680501c43053f7abf3bbcee168d82419dede651e0cb618a737ccb526d0134706
|
|
| MD5 |
63930af0b8c57e986ca60cb7f63249a4
|
|
| BLAKE2b-256 |
5afbe03544f564be7d69b8f04c8db9ff95e5cba6a9e5bc3c83c78d167e40ede6
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rough_heston_qipc-0.1.0-py3-none-any.whl -
Subject digest:
680501c43053f7abf3bbcee168d82419dede651e0cb618a737ccb526d0134706 - Sigstore transparency entry: 1367621478
- Sigstore integration time:
-
Permalink:
soya-git/rough_heston_qipc_project@5b9dc710836bee42c13f7ff844946bcb87d187dd -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/soya-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b9dc710836bee42c13f7ff844946bcb87d187dd -
Trigger Event:
release
-
Statement type: