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 explicit basic or full Greeks calculation
  • 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, OptionType
from kiyosi.market import BlackScholesMertonParameters, PricingContext
from kiyosi.pricing import AnalyticVanillaEngine, GreeksLevel

valuation = date(2025, 1, 1)
option = EuropeanOption(
    option_type=OptionType.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

basic = engine.price_with_greeks(option, context, GreeksLevel.BASIC)
print(basic.price, basic.delta, basic.gamma)

full = engine.price_with_greeks(option, context, GreeksLevel.FULL)
print(full.vega, full.theta)

The Greeks tier is required. basic computes Delta and Gamma; full requests Delta, Gamma, Speed, Theta, Charm, Color, Vega, Vanna, Zomma, and Rho. 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_risk_measures() remains the forced numerical alternative.

C++ uses the same contract: price() returns Result<double> and price_with_greeks(option, context, GreeksLevel::basic) returns Result<PricingResult>. Use GreeksLevel::full 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 MonteCarloBackend, MonteCarloVanillaEngine

engine = MonteCarloVanillaEngine(backend=MonteCarloBackend.CUDA)
result = engine.price(option, context)

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.

Release files for kiyosi 0.6.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.6.0
File Size Uploaded
kiyosi-0.6.0.tar.gz 343.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for kiyosi 0.6.0
File
kiyosi-0.6.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
kiyosi-0.6.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.6.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
kiyosi-0.6.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.6.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
kiyosi-0.6.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.6.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
kiyosi-0.6.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.6.0.tar.gz

Download URL kiyosi-0.6.0.tar.gz
Size 343.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9593e1f3a189ce36dbc4325c5868958fc8ee4c8fe3dabc8722208ee9457facd7
BLAKE2b-256 checksum
How to use checksums
774a3a8102c04dd71d8626476744326b66a6a1f584dbdfffcbd326edd16f75b9
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.0-cp314-cp314-win_amd64.whl
Size 2.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
f932c7a8fa6d05ddccb42f3eacd4bbe564e11251eb5374d3037ddf0d51cc0a44
BLAKE2b-256 checksum
How to use checksums
edcf160f70041e004e09a7f21d30818ed4f9b8072716133bbb14666f7cffc8e1
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.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
09ed88d0eb925a0cfa58310c8f053b380734aeaa3ae47bce31d09243ae23624e
BLAKE2b-256 checksum
How to use checksums
3200422bade7c756e44c9c583c69177045eee98d2bb93d554808b6682dcebc77
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.0-cp313-cp313-win_amd64.whl
Size 2.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
c238b6d45f95d76d26482262244c9ab05b21164517e22c9f571bd1c14f3071a7
BLAKE2b-256 checksum
How to use checksums
4a6fe1bd212857ba86af2171b97dd9fc4fd16d7bd2ee97289c485f35f0545ff3
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.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
0dc872f5b20e76b114a6ced12112466d4763cb62fe575ebff2e0dc2371727e01
BLAKE2b-256 checksum
How to use checksums
e654fa5e7258dceb2b9ce1a6078719e8c4d42b365ad0f84400eb95f67894fc9d
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.0-cp312-cp312-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
eb3ade9df1debb4fca7cbc313ba3d7caa350d6322eff18b8807140d16347d308
BLAKE2b-256 checksum
How to use checksums
8504627efccb9aa7621be3ed76c247a5bac9d7973aae89171af72560e20ec9ab
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.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
252e3b18e1283c05a896e49c79406a6ee2c4eb733832509c2c002add8c131a8b
BLAKE2b-256 checksum
How to use checksums
098f5b8cfbf44d52d1e2200b72137402034606b70070a23d7a7ad9a560bd653a
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.0-cp311-cp311-win_amd64.whl
Size 2.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9357b251a2186d16279a591c68216dec150cd7f59867c85e2f5e377fd056bf3a
BLAKE2b-256 checksum
How to use checksums
5923e849d855b02ae229e486e88c044ccd7d11fc48635d923a986944ec66162c
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 26, 2026.

Transparency log

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

Download URL kiyosi-0.6.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
ec4bee1933e495894202265c95208127085ba195b8db70659e5cb48de6ba8eb9
BLAKE2b-256 checksum
How to use checksums
3c0e9075921e2f107edbc5c9fb5a6249d51dedc34d8e1c6f14a979b297e55786
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 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

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