kiyosi
简体中文 | English
kiyosi 是一个面向 Python 用户的金融衍生品定价库,支持 Black–Scholes–Merton 模型下的香草及奇异衍生品定价,也提供可独立使用的 C++ 库。
项目目前处于 Alpha 阶段,API 可能发生不兼容变更。
支持的产品与功能
| 产品 | 定价方法 |
|---|---|
| 欧式、美式香草期权 | 解析解、美式近似、二叉树、数值积分、有限差分、蒙特卡洛 |
| 现金或无、资产或无数字期权 | 解析解、数值积分、有限差分、CRR 二叉树、蒙特卡洛 |
| 单障碍香草期权 | 解析方法、有限差分、蒙特卡洛、CRR 二叉树、数值积分 |
| 二元障碍与单边触碰/不触碰期权 | 解析方法、有限差分 |
| 双障碍期权 | 连续观察解析定价、有限差分、蒙特卡洛 |
| 现金双边触碰/不触碰期权 | 有限差分 |
| 几何平均、算术平均亚式期权 | 几何平均解析解、算术平均近似、蒙特卡洛 |
| 雪球、凤凰 | 数值积分、有限差分、蒙特卡洛 |
| 累购产品 | 数值积分、有限差分、蒙特卡洛 |
| 区间累计产品 | 边际概率解析定价 |
此外提供:
- Greeks、数值敏感度、隐含波动率及隐含票息求解。
- 无风险利率与股息率期限结构、交易日历和观察日程。
- 蒙特卡洛 CPU 并行及可选 CUDA 后端、伪随机采样、Sobol 准蒙特卡洛采样和对偶变量。
安装 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
许可证
Metadata
Release files for kiyosi 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kiyosi-0.13.0.tar.gz | 1.3 MB | With provenance | Details for kiyosi-0.13.0.tar.gz |
Built distributions (wheels)
Total release size: 52.2 MB
Release files / kiyosi-0.13.0.tar.gz
| Download URL | kiyosi-0.13.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39369c389b2f1bb3392db6e136d40ed79ef062558474b0020c3a05e9daada5e0
|
|
BLAKE2b-256 checksum How to use checksums |
13f42ec1ccab49160515253ad129389dffc84866add42079808a5572aee9b2b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp315-cp315-win_amd64.whl
| Download URL | kiyosi-0.13.0-cp315-cp315-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.15 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
86eca5f71a349734ab2411c8b3bb51634b18ec566704c59dd3fd24c14f53ff01
|
|
BLAKE2b-256 checksum How to use checksums |
f3b13e116ed4032754f8b450b9ba33f21870cbf7648c85cc08a7c2f4f73b2826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | kiyosi-0.13.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.15 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9a55ca194095e0d352e35bd8ddccccb8f9973aab0f337ea5abfe9ad5753155e4
|
|
BLAKE2b-256 checksum How to use checksums |
d4da6fc08cd6ee089ca8df44681232b98205cfb6190c53fb02f0f6eb9f4b8de2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp314-cp314-win_amd64.whl
| Download URL | kiyosi-0.13.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e5889a614c08de5b9ebbe2030eba1041a25eb570b130956a25272f185afbdfd1
|
|
BLAKE2b-256 checksum How to use checksums |
cfd19b129d315756bf81967740244cebc48a071f75b74b3c7c8e90606d7c9bf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | kiyosi-0.13.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
156a6db44f9494c2641ab6216cb2f4490488caf9381f8b56c9061a7f940f2dd0
|
|
BLAKE2b-256 checksum How to use checksums |
46b8fe04df25f028a0546f29beb0c14e5271fa88c8c27da674836d03273c59be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp313-cp313-win_amd64.whl
| Download URL | kiyosi-0.13.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0c2e0f3d6a494bfcd02ec148245009cbf58515e39052de6e059c77bb27a597b7
|
|
BLAKE2b-256 checksum How to use checksums |
3d45304890d83a90bbf11e71a29dee0662e170983ab1ce3bd6aa5c578a70f75a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | kiyosi-0.13.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b2ceb4188233c5d742c47df2410ff9a05074dcb07a8e432be0984f3ca160120e
|
|
BLAKE2b-256 checksum How to use checksums |
393414671ba957af5f00fb4edf9224a2864feeae8706fff4ca6532b2c4be9b22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp312-cp312-win_amd64.whl
| Download URL | kiyosi-0.13.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f53084f058206644c0418eb24a541b7454172dc90b0837d091924baa0adc1a13
|
|
BLAKE2b-256 checksum How to use checksums |
8ad6979caf3f3dffe152d29797874989b4ce2c53df34e1cbfc9467fa78604f62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | kiyosi-0.13.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6f401175c54a70945b5527b639a0198f0206504852c337656f8682427dc5aff7
|
|
BLAKE2b-256 checksum How to use checksums |
c592caa73a8a9854a076ee0c159774884bd35899efa512a10ba0f6c1b00ce734
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp311-cp311-win_amd64.whl
| Download URL | kiyosi-0.13.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7383f46c4358c8203b6a81ca78bb03215d99e610f263ed8ff28e61051debe164
|
|
BLAKE2b-256 checksum How to use checksums |
e453ced6e67efe4dc183ecf2aa7bcf66d71216c9d1c507b97de8150e282f6104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logRelease files / kiyosi-0.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | kiyosi-0.13.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1cee0f90dee5a06a61cf5e44d9ed3bb91ae37f3007c3ae0e15c9ad5f82b1a6ab
|
|
BLAKE2b-256 checksum How to use checksums |
34ef486d09be7106043b89872df3cea0374d2334c7fc893306c08611211175e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 26, 2026.
Transparency logSecurity for kiyosi 0.13.0
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.
Full provenance
All 11 files in this release have been uploaded with provenance metadata.
Attestation for kiyosi-0.13.0.tar.gz
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 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.