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.42+ 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.8.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.8.0-cp313-cp313-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.13Windows x86-64

pyquantlib-0.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.1 MB view details)

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

pyquantlib-0.8.0-cp313-cp313-macosx_11_0_arm64.whl (12.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyquantlib-0.8.0-cp312-cp312-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.12Windows x86-64

pyquantlib-0.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.1 MB view details)

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

pyquantlib-0.8.0-cp312-cp312-macosx_11_0_arm64.whl (12.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyquantlib-0.8.0-cp311-cp311-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.11Windows x86-64

pyquantlib-0.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.2 MB view details)

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

pyquantlib-0.8.0-cp311-cp311-macosx_11_0_arm64.whl (12.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyquantlib-0.8.0-cp310-cp310-win_amd64.whl (10.5 MB view details)

Uploaded CPython 3.10Windows x86-64

pyquantlib-0.8.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (15.2 MB view details)

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

pyquantlib-0.8.0-cp310-cp310-macosx_11_0_arm64.whl (12.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyquantlib-0.8.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.8.0.tar.gz
Algorithm Hash digest
SHA256 2802d24de86477e3f26798016e0fef1a9218d392ef8ce32103a9005610170eed
MD5 1e331db7b5a1ddef7a712aef060e0e9c
BLAKE2b-256 cdb35ecd1259eb9f258abb19c99ebd4d407c9c27172a8073d5f8596710a64eec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.8.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 10.5 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.8.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8c2fd35ad0c529fe455801e1287d28d4e5554f479ed6c3548d4d53345018eafb
MD5 0ac1562ed0706ae050c7ea43dd884eca
BLAKE2b-256 1d742afd9e102a226335f34e19ee232f6bbe9930976b48bfc670dfce09538759

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d4d33a7a7d589f02f3d750860b8204ead64b0e04a42fc3d4e53dad5df9c65981
MD5 ebe56d1a73bc6470794220bc5b5d3814
BLAKE2b-256 9b337af2f38b3b2cc386ce58f7678e8b8477928c85eadb8d60926fa42c1c8b99

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e905e5bd8e5302b21f68964c8149ab9deb20e505106e7a81bc648d8bda80de1
MD5 86ebced280edd228938a136e64efb544
BLAKE2b-256 6855ced92a8cfeadb00a2bd1d442502911ab7cc0438d50de73bc4a5133dc75bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.8.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 10.5 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.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a0a6af1ba7ec67d7e9316b93eb40e227905557958600b73c89b77dfb1dc46c7
MD5 806f3ef23fefdfa0bcb07f58931414d8
BLAKE2b-256 043dc5a9071e5d5ba383aaaf49a8090d9a6577612d7d124594779dbafdb9fde7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f84d539b8b282185f5051e1fd5980e281a0a8c4ebbf5946d75f08f75473b6c17
MD5 797114103f1656fe375c52823fde7a2d
BLAKE2b-256 14a3bfae96c1c35e16e2e25b92c8c8fe71db39332c54b476fc93d79ca8f527bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a427858f2b92a2162c45b83fd4652fb18ac6a98fafe0ee9aa0cd61dbfafdb8cd
MD5 d8bd98cffb9592c6d0bd3ce2ade82816
BLAKE2b-256 9edea64d003e2b6189c5bb3e64937477bcaa94b0e45907f0a3ec389b2d3840fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.8.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 10.5 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.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 65c0b8189feccda735094eae088c40bfa123cee1da6c6d30ddff26bcacc114c6
MD5 c18a9634c5e7de30b1b69472e49829c8
BLAKE2b-256 a79ccb4445df945eb5050eb31b6c9d0b893e125c15a7a0a35c51938d9a227e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af6cb0e588b906040fcd4ba05c8f058937a92657d2d3f835cc4d6423aa5bb0a3
MD5 86f6da5e997f171235842aff1d524cd4
BLAKE2b-256 cc6ce1715a4b70cf53be53777f7435cd6ea26c0aa7105b9ef3b8a96fb9c00f8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c0bbdaf24394151a442bb4cfd19c5798d0080433e0f6b949a34e4b2789f52ff
MD5 4a658f8924e9eb7527a7af40761ae436
BLAKE2b-256 b1e2d876ccada778128f41606b02084099576f971e23506ac8bc8842b399a1e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyquantlib-0.8.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 10.5 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.8.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ad02018e2a1198204c22e697887ae6a43693f006028e3abcd65e0f312290e1b2
MD5 ae7800c316e2de529f27f3012b616a0c
BLAKE2b-256 4a96e73eb32faa0e16f31012e26b361216461679bb76740111cbea0b5607fe5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7bf3f13e50baebdba2ef38ebee54568610e01f5959661e2a98ad32c09c4b217a
MD5 2952795adecb96d46a0d73fc4137cec1
BLAKE2b-256 73145e354a05dbc3f7b93bea59ae22ba5babb79ccda098387fa0005565fb2f7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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.8.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyquantlib-0.8.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db1614067063e1193db8229efe17821f3d32b4aa5452a49df24e8ca1294686af
MD5 9a173e6b56cb768541890b23a1572101
BLAKE2b-256 4b2778d9ef0a858a1e85bdd761e9964374e8e457ee37fa9d7e999e9d803b9c87

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyquantlib-0.8.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

0.9.0

13 files

This release

0.8.0 This release

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