Skip to main content

kiyosi

PyPI MIT License

简体中文 | English

kiyosi 是一个面向 Python 用户的金融衍生品定价库,支持 Black–Scholes–Merton 模型下的香草及奇异衍生品定价,也提供可独立使用的 C++ 库。

项目目前处于 Alpha 阶段,API 可能发生不兼容变更。

支持的产品与功能

产品 定价方法
欧式、美式香草期权 解析解、美式近似、二叉树、数值积分、有限差分、蒙特卡洛,具体支持取决于行权方式
现金或无、资产或无数字期权 解析解、数值积分、有限差分
障碍期权、二元障碍与触碰类期权 解析方法;普通障碍期权另支持有限差分
几何平均、算术平均亚式期权 几何平均解析解、算术平均近似
雪球、二元雪球、三元雪球、凤凰及累购产品 有限差分、蒙特卡洛

此外提供 Greeks、数值敏感度、隐含波动率及隐含票息求解、交易日历和观察日程。蒙特卡洛引擎支持 CPU 及可选 CUDA 后端。

安装 Python 包

需要 Python 3.11 或更新版本。从 PyPI 安装:

python -m pip install kiyosi

预编译 wheel 无需本地 C++ 工具链;从源码构建需要 C++23 编译器、CMake 3.28+ 和 oneTBB 2023.1+(未安装时自动下载)。

Windows 源码构建和 CMake 预设使用 clang-cl。请安装 Visual Studio C++ 工具及 C++ Clang 编译器组件,并在 Visual Studio Developer PowerShell 中运行构建命令。

Python 快速上手

计算一年期欧式看涨期权的价格。利率、股息率和波动率使用小数,利率和股息率采用连续复利。

from datetime import date

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

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

price = AnalyticVanillaEngine().price(option, context)
print(f"Price: {price:.6f}")  # 8.827321

许可证

采用 MIT 许可证。

Metadata

Release files for kiyosi 0.11.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.11.0
File Size Uploaded
kiyosi-0.11.0.tar.gz 584.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for kiyosi 0.11.0
File
kiyosi-0.11.0-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details
kiyosi-0.11.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
kiyosi-0.11.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
kiyosi-0.11.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
kiyosi-0.11.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
kiyosi-0.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
kiyosi-0.11.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
kiyosi-0.11.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.11.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
kiyosi-0.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details

Total release size: 30.3 MB

Release files / kiyosi-0.11.0.tar.gz

Download URL kiyosi-0.11.0.tar.gz
Size 584.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d3861898abf32f4ddda648a15e582dbf25fd51468e3845c0741db20eea299d52
BLAKE2b-256 checksum
How to use checksums
e9dbcafa687a6dadb2adef92408d8669b8445b645517967177ffa3fe8ce2e251
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 Oct 19, 2026.

Transparency log

Release files / kiyosi-0.11.0-cp315-cp315-win_amd64.whl

Download URL kiyosi-0.11.0-cp315-cp315-win_amd64.whl
Size 3.0 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
2998f81c5945bc7e834a7058d216117ced9fa364e37b6777e2c87020958ce590
BLAKE2b-256 checksum
How to use checksums
33b51be20cb0c9a97d347a3e82433fdac0dd006be1034c264f81a7870bdf710a
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 Oct 19, 2026.

Transparency log

Release files / kiyosi-0.11.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL kiyosi-0.11.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.9 MB
Tags CPython 3.15 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
466dfe7367bb18a18c40de2d82f0fcba9470ff5d9f6511dcd811a68f015b343b
BLAKE2b-256 checksum
How to use checksums
9be35ab012ae3679b32f16e2fca9d383f5c3ce75f300076d7e416ed597e0451c
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp314-cp314-win_amd64.whl
Size 3.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
c43537d2fd6670154f72bd4afc291b89f5026625e594ef8daf0e1fd10786f45a
BLAKE2b-256 checksum
How to use checksums
941f22d2b5abdf881bb5322bdcdc8229cd58be81d0f814ac1f6c032e32f6453e
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.9 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3a0e9a49f65d4ce6c3c78557fdb493119ead65d8f705dba19d2418670730b2ec
BLAKE2b-256 checksum
How to use checksums
246ba728f243aa4b74711746e51d2cddbc5bf05bcbb59ba81d5b2b19a583ca5e
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp313-cp313-win_amd64.whl
Size 3.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
50fe468e1857dc642773b5aa8796f976c06683febd920922dc75bdcf3d054e0f
BLAKE2b-256 checksum
How to use checksums
0e129d565b7edc9ec2f0410d826fd4a75fa30fec759f8df2e95f8944e297f857
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.9 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
33bd466bb7b6b84062c4ffdf60ea62f6126b61f2f9dcff34d022dbdd3751d82b
BLAKE2b-256 checksum
How to use checksums
4023c2a432ebb5107e74d7c07433eceed1d71655e2cfbf91106e3db03acbb7e0
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp312-cp312-win_amd64.whl
Size 3.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f51ed0a6d66b2c92bd0d995629b6eaab9d1a1e98bf46b8cebb9f10139770563d
BLAKE2b-256 checksum
How to use checksums
bf89b2af97ada6545c3be140f9477f98a14a9f77d83307cb7ea7a9b3dd8de237
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.9 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6dbbfa867fe43ecb09cba652b02bb9640218bd73debba13a1680f0022fd629ba
BLAKE2b-256 checksum
How to use checksums
18a35f2d0637672e6ffa136b214fd671a4bee45aa60dafb6b06a959c3c55e459
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp311-cp311-win_amd64.whl
Size 3.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
13eed1154cde341debec3f4f958f6c30ad060f821bc248944096259ce522626b
BLAKE2b-256 checksum
How to use checksums
d7705d23d39b909bc42b4dd197ac760663f3389d0aec5c1ae6cefc15e395cf74
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 Oct 19, 2026.

Transparency log

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

Download URL kiyosi-0.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.9 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
bf15f8232011c8a4c7200adb456e11f607a382c1db990860c79c6a0de2d2e695
BLAKE2b-256 checksum
How to use checksums
17065defcd359176da58ddb8d9c235637a76417b1d812c26d639fadf70959444
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 Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.11.0 This release

11 release files

0.9.0

9 release files

0.8.0

9 release files

0.7.0

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