Skip to main content

Kiyosi

Kiyosi is a modern C++23 derivatives-pricing library with Python bindings, offering consistent APIs for vanilla, exotic, and structured products.

PyPI License: MIT

Features

  • Vanilla, digital, Asian, barrier, accumulator, snowball, and phoenix instruments
  • Analytic, tree-based, finite-difference, integral, and Monte Carlo pricing engines with CPU and CUDA backends
  • Price-only valuation and on-demand calculation of selected Greeks
  • Numerical analytics, implied volatility, and implied coupon solvers
  • Trading calendars and observation schedule builders, including SSE holidays
  • A native C++ core exposed through a Python-first API

Quick start with Python

Kiyosi requires Python 3.11 or newer:

python -m pip install kiyosi

PyPI provides prebuilt x64 wheels for Windows and Linux, including CUDA acceleration for Monte Carlo engines. CPU remains the default; using CUDA requires a compatible NVIDIA GPU and driver. On other platforms, installation builds from source and requires CMake 3.28 or newer, Ninja, and a C++23 compiler.

Price a European call with the analytic Black-Scholes engine:

from datetime import date

from kiyosi.instruments import EuropeanOption
from kiyosi.market import BlackScholesMertonParameters, PricingContext
from kiyosi.pricing import AnalyticVanillaEngine

valuation = date(2025, 1, 1)
option = EuropeanOption(
    option_type="call",
    strike=100.0,
    effective_date=valuation,
    expiry_date=date(2026, 1, 1),
)
context = PricingContext(
    model_parameters=BlackScholesMertonParameters(
        risk_free_rate=0.05,
        dividend_yield=0.02,
        volatility=0.20,
    ),
    spot_price=100.0,
    valuation_time=valuation,
)

engine = AnalyticVanillaEngine()
print(engine.price(option, context))  # float; no Greeks are calculated

selected = engine.price_with_greeks(option, context, ["delta", "gamma"])
print(selected.price, selected.delta, selected.gamma)

full = engine.price_with_greeks(option, context, all_greeks=True)
print(full.vega, full.theta)

Pass one lowercase Greek name or an iterable of them to request Greeks. all_greeks=True requests Delta, Gamma, Speed, Theta, Charm, Color, Vega, Vanna, Zomma, and Rho. The two request forms are mutually exclusive. Native Greeks are reused; missing feasible measures use numerical price differences. Unrequested or undefined measures are None, including all Greeks at expiry. Shift keyword arguments (spot_shift, volatility_shift, rate_shift, and time_shift_days) control numerical supplementation. Monte Carlo base and bumped valuations share one seed per call without changing the engine settings. calculate_numerical_greeks() remains the forced numerical alternative.

C++ uses the same contract: price() returns Result<double> and price_with_greeks(option, context, {Greek::delta, Greek::vega}) returns Result<PricingResult>, whose price() is always present. Use true as the third argument for all ten Greeks and pass an optional NumericalShiftSettings as the final argument to customize shifts.

The Python API is organized into three modules:

Module Contents
kiyosi.instruments Derivative instruments and structured-product presets
kiyosi.market Model parameters, valuation contexts, calendars, and schedules
kiyosi.pricing Pricing engines, analytics, scenarios, and implied-value solvers

Select the CUDA backend on any Monte Carlo engine:

from kiyosi.pricing import MonteCarloVanillaEngine

engine = MonteCarloVanillaEngine(backend="cuda")
result = engine.price(option, context)

Enum-like Python inputs use lowercase strings such as "call", "cuda", and "crank_nicolson". Properties return the same strings. Public OptionType, MonteCarloBackend, and similar names are typing.Literal aliases for static type checking; KiyosiError.category remains an ErrorCategory Enum.

Pricing coverage

Instrument family Available engines
European vanilla Analytic, CRR binomial, finite difference, integral, Monte Carlo
American vanilla Bjerksund-Stensland, CRR binomial, finite difference, Monte Carlo
Cash-or-nothing and asset-or-nothing digital Analytic, finite difference, integral
Barrier Analytic, finite difference
Binary barrier and touch Analytic
Geometric-average Asian Closed form
Arithmetic-average Asian Turnbull-Wakeman approximation
Accumulator Finite difference, Monte Carlo
Phoenix and snowball variants Finite difference, Monte Carlo

Model scope

The current pricing models use a Black-Scholes-Merton market context with spot and flat risk-free rate, dividend yield, and volatility parameters. Volatility surfaces and rate curves are not part of the current API.

Validation

Kiyosi's pricing tests compare results with reference values generated independently of Kiyosi using QuantLib. QuantLib is used by the reference-generation tooling and SSE calendar maintenance script; it is not a build or runtime dependency of the C++ core.

For performance comparisons against QuantLib C++, see the pricing benchmark matrix.

C++ library

Building the C++ core requires CMake 3.28 or newer, Ninja, and a C++23 compiler. On Linux, configure, build, test, and install with:

cmake --workflow --preset linux-release
cmake --install out/build/linux-release

On Windows, run the commands from a Visual Studio Developer PowerShell and replace linux-release with windows-release.

After installation, consume the exported CMake target:

find_package(kiyosi CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE kiyosi::kiyosi)

Include the umbrella header with #include <kiyosi/kiyosi.hpp>. See examples/all_pricing_engines.cpp for a broader example covering the available instrument and engine families.

License

Kiyosi is available under the MIT License.

Metadata

Release files for kiyosi 0.7.0

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

Source distribution (sdist)

Source distribution for kiyosi 0.7.0
File Size Uploaded
kiyosi-0.7.0.tar.gz 342.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for kiyosi 0.7.0
File
kiyosi-0.7.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
kiyosi-0.7.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
kiyosi-0.7.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
kiyosi-0.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
kiyosi-0.7.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
kiyosi-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
kiyosi-0.7.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
kiyosi-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 16.5 MB

Release files / kiyosi-0.7.0.tar.gz

Download URL kiyosi-0.7.0.tar.gz
Size 342.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5595d71144f5a7e273b8d886bbf4a29ba1dc48f9ebfc145def98424d010ba131
BLAKE2b-256 checksum
How to use checksums
c93d6a910f279985133b12b07917bf1b1fcc7c2ad4425ebe27d07724eb71aeac
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp314-cp314-win_amd64.whl

Download URL kiyosi-0.7.0-cp314-cp314-win_amd64.whl
Size 2.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
754cde94f7e6f024438a6412ab0964b254ff275ba900e0e1b381e6fe9869cc95
BLAKE2b-256 checksum
How to use checksums
8142197476cf13c8b4671ef30592d29cda825c2817fb633cf4e6e012a7377b99
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL kiyosi-0.7.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
320272ff3ff293d367fe82726da1b92917a5fc0f6c2020013241ee136259b172
BLAKE2b-256 checksum
How to use checksums
9bf0c1f3a841205a2674448fbd36da2cf47fa307c8a10d2b6c70ec8ca6c99f68
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp313-cp313-win_amd64.whl

Download URL kiyosi-0.7.0-cp313-cp313-win_amd64.whl
Size 2.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
3c7bb4d6a4d4a229b03d9d50f3c2e5e149f842a876a300378452ee23bbeb3605
BLAKE2b-256 checksum
How to use checksums
1468f229742cab5353aa3c49922e6c4eacb8d59f84c21a3a83cc26b5714713dc
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL kiyosi-0.7.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3f07c79f9f37352bba3b238a1d4353a7817caa267f30388c05aec2dce7f2099c
BLAKE2b-256 checksum
How to use checksums
a3bd31b04e7e2e804aab01c3f6cbad9acb8c873348e22c1ca62fd0f5cf226a16
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp312-cp312-win_amd64.whl

Download URL kiyosi-0.7.0-cp312-cp312-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
528b604cf65cc13c300a02f309967008454b662b3ecbfa34a5a5b61606df7e1b
BLAKE2b-256 checksum
How to use checksums
f6f020c5d602200633b797b9177dc43ee0a41327811732bb7272d64b483c13c5
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL kiyosi-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f06d58fa83b8a2d0665e132d02fc1ecf02f70a7beb256b2343c8ebd9c699a87c
BLAKE2b-256 checksum
How to use checksums
9bfc0459e55f132b0f90eee29e024e3226e7c64f7ff35ac6feb1d3e7098d210b
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp311-cp311-win_amd64.whl

Download URL kiyosi-0.7.0-cp311-cp311-win_amd64.whl
Size 2.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e5806f7d1978757776fcca9259a15d969a821f94466b82a1173bd587c3270ae2
BLAKE2b-256 checksum
How to use checksums
f8d78dae8289f15f41cecb3946f7f7f99b3d897ec9098fb812b8bb4b40b3506a
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 Sep 27, 2026.

Transparency log

Release files / kiyosi-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL kiyosi-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5097f12ca32dc9bfb6dd11f2c33284d4099d16e02116aed16cd9e2acb3bb249b
BLAKE2b-256 checksum
How to use checksums
1b67708a12d8cf7444139b383b8110933ef49dec0a036b7eab189ead8f098b6f
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 Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.0

9 release files

0.8.0

9 release files

This release

0.7.0 This release

9 release files

0.6.0

9 release files

0.5.0

9 release files

0.4.0

9 release files

0.3.0

17 release files

0.2.0

5 release files

0.1.0

2 release 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