Skip to main content

PyQuantLib: Modern Python bindings for QuantLib

Documentation macOS Linux Windows codecov PyPI DOI License Python PRs Welcome

Overview

PyQuantLib provides Python bindings for QuantLib, the open-source library for quantitative finance. It is built on pybind11: every binding is written in standard C++, with no interface-definition language and no code-generation step between the caller and the QuantLib source.

As an independent project, PyQuantLib complements the official QuantLib-SWIG bindings, which remain the established and most widely used way to run QuantLib from Python.

Features

  • Pythonic API: pass quotes and term structures directly; handles are created internally. Plain Python types convert automatically, and None replaces Null<Real>().
  • Zero-copy NumPy: Array and Matrix use the buffer protocol, so np.array(arr, copy=False) shares memory with no marshalling.
  • Type hints: complete .pyi stubs ship in the wheel for autocomplete and type-checking.
  • Python subclassing: override QuantLib's abstract base classes via pybind11 trampolines, without C++ recompilation.
  • Modern build: scikit-build-core, CMake presets, cross-platform CI.

Installation

pip install pyquantlib

Pre-built wheels are available for Python 3.10 to 3.13 on Linux (x86_64), macOS (ARM), and Windows (x64). QuantLib is statically linked, so no separate installation is required.

From source

Building from source requires QuantLib 1.43+ compiled with specific CMake flags. Packages from Homebrew, vcpkg, and apt use shared builds and boost::shared_ptr, and are not compatible. See CONTRIBUTING.md for the required flags and full build instructions.

pip install git+https://github.com/quantales/pyquantlib.git

Quick start

import pyquantlib as ql

# Set evaluation date
today = ql.Date(15, 6, 2025)
ql.Settings.evaluationDate = today

# Market data
spot = ql.SimpleQuote(100.0)
rate = ql.SimpleQuote(0.05)
vol  = ql.SimpleQuote(0.20)

# Term structures (pass quotes directly; handles created internally)
dc         = ql.Actual365Fixed()
risk_free  = ql.FlatForward(today, rate, dc)
dividend   = ql.FlatForward(today, 0.0, dc)
volatility = ql.BlackConstantVol(today, ql.TARGET(), vol, dc)

# Black-Scholes process
process = ql.GeneralizedBlackScholesProcess(spot, dividend, risk_free, volatility)

# European call option, 1 year to expiry
payoff   = ql.PlainVanillaPayoff(ql.Call, 100.0)
exercise = ql.EuropeanExercise(today + ql.Period("1Y"))
option   = ql.VanillaOption(payoff, exercise)

# Price with analytic Black-Scholes
option.setPricingEngine(ql.AnalyticEuropeanEngine(process))

print(f"NPV:   {option.NPV():.4f}")    # 10.4506
print(f"Delta: {option.delta():.4f}")  # 0.6368
print(f"Gamma: {option.gamma():.4f}")  # 0.0188
print(f"Vega:  {option.vega():.4f}")   # 37.5240
print(f"Theta: {option.theta():.4f}")  # -6.4140

Module organization

import pyquantlib as ql          # Concrete classes
from pyquantlib.base import ...  # Abstract base classes (for subclassing)

Coverage includes dates and calendars, market quotes, yield and volatility term structures, stochastic processes, instruments, and pricing engines. See the API Reference for the complete list.

Documentation

Full documentation is available at pyquantlib.readthedocs.io.

Section Contents
Quickstart Installation and a first pricing example
Concepts Term structures, observables, engines, calibration, and the binding patterns behind them
Cookbook Runnable recipes: curve bootstrapping, volatility surfaces, Heston calibration, NumPy interop
Examples Jupyter notebooks, also available in examples/
API Reference Every bound class, by module
Architecture Design rationale and internals
Changelog Release history

Development

See CONTRIBUTING.md for development setup and guidelines.

# Clone and install in development mode
git clone https://github.com/quantales/pyquantlib.git
cd pyquantlib
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -e .

# Run tests
pytest

License

BSD 3-Clause License. See LICENSE for details.

QuantLib is free software distributed under its own modified BSD license, and is copyright of its respective contributors.

Download files

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

Source Distribution

pyquantlib-0.9.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

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

pyquantlib-0.9.0-cp313-cp313-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.13Windows x86-64

pyquantlib-0.9.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyquantlib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyquantlib-0.9.0-cp312-cp312-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pyquantlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyquantlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyquantlib-0.9.0-cp311-cp311-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.11Windows x86-64

pyquantlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyquantlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (12.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyquantlib-0.9.0-cp310-cp310-win_amd64.whl (10.6 MB view details)

Uploaded CPython 3.10Windows x86-64

pyquantlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyquantlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (12.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pyquantlib-0.9.0.tar.gz.

File metadata

  • Download URL: pyquantlib-0.9.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyquantlib-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ec0d752fe0e9c591bf8fcfeaa54e892538575f36ebf7d0a198fe01f0de4fa44e
MD5 c66b5d3ecdc7ca62fe257a02b3d4233c
BLAKE2b-256 0bdc494f5be036798a719da08f4b76457fa2476611ed02d85e651c185f8fc67c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0.tar.gz:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.9.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 10.6 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyquantlib-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0072c36abde0cf8bcdc401728043583f3c13cb9b046fc9b85b5aa2a89e786e2c
MD5 ee59db9f418bd1925afed4c0a66ea03a
BLAKE2b-256 07378c03f0f5e2add8c0afafc04c725ed038df412360bcec299371a07bafcecc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3c5a839358dc73f7038dbd57a43e76c3774facba9311cb6a034aa01d8924d2c9
MD5 cf23a1e38f0f1f8d61d9b24718e34317
BLAKE2b-256 05c73eae24577b581f56793bc296f6e690cd745ff713e3b265454d7dc7c64ace

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 749a146961d8fd617386a39f2b794a45e6f1fcf90ad6cfb00a3ccc6473e6070c
MD5 8f7fbb18eeb6b92a1915b061a41ce8f1
BLAKE2b-256 4e26d33130e66d88290eaabf3ba13402c28adce1ed7d8db0d666afb8c85cfc09

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.9.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 10.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyquantlib-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5f523016d52ef4cf56ba56df37a87c827a6cbb280f0c3e8b67258b16ef383a9e
MD5 9d7956887a4b1db9d43cf3a1e6d40f86
BLAKE2b-256 a31457884aca99e141f1d44061d55b75cd90371c24a0d6fff0d26b6bf4510f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b4edcb9632feb0411576cec58a6425b42343cfa0701c9e77e037d487d55f7e05
MD5 c3217ec9db6dc6d3afe0b2b179942128
BLAKE2b-256 d1bc64dfd1fd38bcbfa1923ac8171eadadb7921d5f0d462dd7a4a2f9c9c55401

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9447485977f414e20671c622a3fd626f4c85d3c08ff8470e327c701c9fa1e002
MD5 bcbfe5e3b6d7b9a5fad8363dc621bfa8
BLAKE2b-256 599b7b213b21cd45166d45cb56680324222b8b415b21ab3575255f1fa1ed90a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.9.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 10.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyquantlib-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6b2ea69b70b7b7316bfc155d8ba1c09de2ba4e2d2cd2cbbc1deecb4b71f54668
MD5 53b1128dafcc24398a6b4cafa892cc80
BLAKE2b-256 ce43a97211ae41dcbd4dc3ff6c6d05278a688eabbad875ee509cb152a985cef5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 553160d2ede14d6868d28b9b5e095b2be0a5501be400ad0c876cd5fac6bc4a1d
MD5 20f0ec23221c5c50f88ef544896ee98b
BLAKE2b-256 1beb9acdb0cdd5937cd55ada41d28f6650c7a98c8aa78a2863d5051c484fffd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebc4ba7387e7228ed88fdd7adb776e5651691db36619a52e486cd372fb77ff34
MD5 3b66e5274b3ab328b1a3509f075a7452
BLAKE2b-256 f6c5ca2874bb03fe3fe81d5977a7b971feb01cb6ffc32476ce8738816e855a00

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.9.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 10.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyquantlib-0.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5d7d0d9b9762de529788717c382b9bda8e6062c469962ce4580f2c63dff7dd43
MD5 9be227b5a619f4ed9eb80458824b1434
BLAKE2b-256 0014daec4c6915cb6157d847119cf98658ca0181f37b5f8f6ff72baf3ca42ed8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2febcf3e36c19eec423182e33fb9a83809a49e73b682c520de15b6cac32fa859
MD5 57e1c23a4374b3ca6fe01a2cd33a0b17
BLAKE2b-256 62ca4b3b4a7431bdde7423b2fced7d65f86597185984cfe8f28dffa1bfcb9981

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

File details

Details for the file pyquantlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d6ee13aab8a8291c8d5984339a34a058ea578a17bd9e88375a5f16e34985910
MD5 ad2ef86a834847ae8ff28eec5934529a
BLAKE2b-256 f5099dd7666c97f382bb9a9d4ecad768ef4fb24be4593212c0bba9ddcf9cc696

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.9.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: wheels.yml on quantales/pyquantlib

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

Release history Release notifications | RSS feed

This release

0.9.0 This release

13 files

0.8.0

13 files

0.7.0

13 files

0.6.0

13 files

0.5.1

13 files

0.4.0

13 files

0.3.0

13 files

0.2.0

13 files

0.1.0

13 files

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