garch-lnmm
Log-normal and Shifted-lognormal moment-matching simulation for European call option pricing under the GARCH diffusion model
Problem
The continuous-time GARCH diffusion model is useful for stochastic volatility option pricing, but standard Euler discretization can generate negative variance values. In practice, truncation is often applied, which may introduce discretization bias under coarse time steps.
This package implements and compares positivity-preserving moment-matching schemes, including Log-Normal Moment-Matching (LN-MM) and Shifted Log-Normal Moment-Matching (SLN-MM), against Euler conditional Monte Carlo and the Taylor closed-form analytical approximation from Barone-Adesi et al. (2003).
The conditional mean, variance, and skewness used in these schemes are computed from the exact conditional moments of the next-step GARCH diffusion variance transition.
Installation
pip install garch-lnmm
Quick Start
from garch_lnmm import GarchDiffusionMC
model = GarchDiffusionMC(
S0=100,
V0=0.16,
r=0.05,
kappa=0.75,
theta=0.04,
sigma=0.85,
rho=0,
T=5,
)
lnmm_price = model.simulate_moment_matching_cond_mc(
N_paths=50000,
N_steps=32,
K=130,
seed=42,
)
slnmm_price = model.simulate_shifted_lognormal_cond_mc(
N_paths=50000,
N_steps=32,
K=130,
seed=42,
)
print("LN-MM price:", lnmm_price)
print("SLN-MM price:", slnmm_price)
API Reference
GarchDiffusionMC(S0, V0, r, kappa, theta, sigma, rho, T)
Main simulator class for the continuous-time GARCH diffusion model.
| Parameter | Type | Description |
|---|---|---|
S0 |
float | Initial stock price |
V0 |
float | Initial variance |
r |
float | Risk-free interest rate |
kappa |
float | Mean-reversion speed of variance |
theta |
float | Long-run variance level |
sigma |
float | Volatility of variance |
rho |
float | Correlation parameter |
T |
float | Maturity |
simulate_euler_cond_mc(N_paths, N_steps, K, seed=None, return_stats=False)
Prices a European call using truncated Euler conditional Monte Carlo.
| Parameter | Type | Description |
|---|---|---|
N_paths |
int | Number of Monte Carlo paths |
N_steps |
int | Number of time steps |
K |
float | Strike price |
seed |
int or None | Random seed |
return_stats |
bool | If True, return price and error statistics |
Returns:
| Field | Type | Description |
|---|---|---|
price |
float | Estimated option price |
std_dev |
float | Sample standard deviation |
std_error |
float | Monte Carlo standard error |
simulate_moment_matching_cond_mc(N_paths, N_steps, K, seed=None, return_stats=False)
Prices a European call using the Log-Normal Moment-Matching scheme.
| Parameter | Type | Description |
|---|---|---|
N_paths |
int | Number of Monte Carlo paths |
N_steps |
int | Number of time steps |
K |
float | Strike price |
seed |
int or None | Random seed |
return_stats |
bool | If True, return price and error statistics |
Returns:
| Field | Type | Description |
|---|---|---|
price |
float | Estimated option price |
std_dev |
float | Sample standard deviation |
std_error |
float | Monte Carlo standard error |
simulate_shifted_lognormal_cond_mc(N_paths, N_steps, K, seed=None, return_stats=False)
Prices a European call using the Shifted Log-Normal Moment-Matching scheme.
This method computes the first three exact conditional raw moments of the next-step variance transition (V(t+h)), converts them into conditional mean, variance, and skewness, and then samples from a shifted-lognormal approximation matching these moments.
| Parameter | Type | Description |
|---|---|---|
N_paths |
int | Number of Monte Carlo paths |
N_steps |
int | Number of time steps |
K |
float | Strike price |
seed |
int or None | Random seed |
return_stats |
bool | If True, return price and error statistics |
Returns:
| Field | Type | Description |
|---|---|---|
price |
float | Estimated option price |
std_dev |
float | Sample standard deviation |
std_error |
float | Monte Carlo standard error |
License
MIT
Demo Notebook
References
Choi, J., Hu, L., & Kwok, Y. K. (2024).
Efficient and Accurate Simulation of the Stochastic-Alpha-Beta-Rho Model.
Motivates the shifted-lognormal moment-matching framework used in the SLN-MM extension.
Barone-Adesi, G., Rasmussen, H., & Ravanelli, C. (2003).
An Option Pricing Formula for the GARCH Diffusion Model.
Provides the conditional moments and Taylor approximation used as analytical benchmarks in this project.
Andersen, L. (2008).
Simple and Efficient Simulation of the Heston Stochastic Volatility Model.
Motivates the moment-matching methodology adopted for the variance simulation scheme.
Metadata
Release files for garch-lnmm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| garch_lnmm-0.1.0.tar.gz | 6.5 kB | With provenance | Details for garch_lnmm-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| garch_lnmm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for garch_lnmm-0.1.0-py3-none-any.whl |
Total release size: 13.2 kB
Release files / garch_lnmm-0.1.0.tar.gz
| Download URL | garch_lnmm-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acd7522ab6555fc1177c5773e664a6056d9d8e00faf599b31f6bde66248bd7bf
|
|
BLAKE2b-256 checksum How to use checksums |
1b1315e54f5e047d8b7205e522c7ba3dcd927bcc80a61f4db9f8308d501ef55f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logRelease files / garch_lnmm-0.1.0-py3-none-any.whl
| Download URL | garch_lnmm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52099363ba9d2d4fd5d592bfe846bb6a49374bcd23d63868e3c663670916eb9b
|
|
BLAKE2b-256 checksum How to use checksums |
590c899eafb72f0bb51c592f74dab61595b22572a647e1524b726865059a4c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logSecurity for garch-lnmm 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for garch_lnmm-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.