Skip to main content

hestonpy

hestonpy is a Python package for pricing, calibrating and hedging options under stochastic volatility models, built around the Heston framework (with Black-Scholes and Bates also included). It's aimed at anyone who wants to simulate paths, price vanilla options, calibrate a model to a market smile, or explore optimal portfolio allocation under Heston dynamics, without having to reimplement the underlying numerical machinery from scratch.

Documentation: https://sarcasticmatrix.github.io/hestonpy/

Installation

hestonpy is available on PyPI:

pip install hestonpy

It requires Python 3.10+ and depends on numpy, scipy, pandas, matplotlib, tqdm and yfinance.

Features

  • Models: Black-Scholes, Heston, and Bates (Heston with jumps)
  • Simulation: Euler and Milstein discretization schemes for asset and variance paths
  • Pricing: Monte Carlo, Fourier-transform, and Carr-Madan methods for European vanilla options
  • Greeks & hedging: delta/vega computation and delta-vega hedging
  • Calibration: fit model parameters to market implied volatility smiles and surfaces, with support for pulling option chain data from Yahoo Finance or user-supplied data
  • SVI / SSVI: Stochastic Volatility Inspired parametrization for smiles and surfaces

Quick start

from hestonpy import Heston

model = Heston(
    spot=100,
    vol_initial=0.04,
    r=0.02,
    kappa=2.0,
    theta=0.04,
    drift_emm=0.0,
    sigma=0.3,
    rho=-0.7,
)

# Simulate asset price and variance paths
S, V, null_variance = model.simulate(
    time_to_maturity=1,
    scheme="milstein",
    nbr_points=252,
    nbr_simulations=10_000,
)

# Price a European call
price = model.call_price(strike=100, time_to_maturity=1)

Calibrating to a market smile:

from hestonpy import VolatilitySmile

smile = VolatilitySmile(...)  # see docs for constructing from market/Yahoo Finance data
calibrated_params = smile.calibration(...)

More worked examples (pricing, calibration, hedging, asset allocation) are available in the example/ directory of the repository.

Project layout

src/hestonpy/
├── models/         # Black-Scholes, Heston, Bates, calibration (SVI/SSVI)
├── option/         # Option and OptionsBook abstractions, market data fetching

Contributing

Contributions are welcome — see CONTRIBUTING.md and CONDUCT.md for guidelines.

License

hestonpy was created by Théophile Schmutz (@SarcasticMatrix). It is licensed under the MIT license — see LICENSE for details.

Metadata

Release files for hestonpy 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hestonpy 0.6.2
File Size Uploaded Provenance Actions
hestonpy-0.6.2.tar.gz 41.2 kB With provenance Details for hestonpy-0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hestonpy 0.6.2
File Interpreter ABI Platform Actions
hestonpy-0.6.2-py3-none-any.whl Python 3 none any Details for hestonpy-0.6.2-py3-none-any.whl

Total release size: 94.3 kB

Release files / hestonpy-0.6.2.tar.gz

Download URL hestonpy-0.6.2.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0b50072ec77e69072b3469ce6fba115b2d03327b8303be26c6b6c909e46967a0
BLAKE2b-256 checksum
How to use checksums
442b24255a6bf476b7d448a083ba44a1af62c37bce3ebeaa2827d4de59f2f021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 30, 2026.

Transparency log

Release files / hestonpy-0.6.2-py3-none-any.whl

Download URL hestonpy-0.6.2-py3-none-any.whl
Size 53.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33c912cf6fcb727457a8c4819ec9fce356b801df0b9acd4b801ea78610af2240
BLAKE2b-256 checksum
How to use checksums
71d6c5991e744d8f301b748e278490e78e43892a494de0da2865f74112ff2bea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 30, 2026.

Transparency log

Security for hestonpy 0.6.2

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.

Select from 2 files

Attestation for hestonpy-0.6.2.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 Aug 30, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page