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+。

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.10.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.10.0
File Size Uploaded
kiyosi-0.10.0.tar.gz 550.8 kB Details

Built distributions (wheels)

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

Release files / kiyosi-0.10.0.tar.gz

Download URL kiyosi-0.10.0.tar.gz
Size 550.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c16ed82fcc0a3fe680481403d1a1c594ec6ba467fb0590231507b3cd11431fb8
BLAKE2b-256 checksum
How to use checksums
51fd74eafd0d7ad5970a667c21a3f773ba613af02e787af325c76295d4a93bff
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.0-cp315-cp315-win_amd64.whl
Size 2.6 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
023c35e988f13f5fe0499126785cc101d591adada0af222b8528099fcf4b3bd5
BLAKE2b-256 checksum
How to use checksums
00372996289031aac5c0bbbbb9e40db72576c07daf63fba15cb98ad6c7df28ac
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.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
3c498da640177768eecf01bcc73b8c6c81b911f7620fd9ad43be35e3f97aef32
BLAKE2b-256 checksum
How to use checksums
b51ba85e006d869ca16d49d43c4868dd8d42b1df89223461a284a79d66f4a184
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.0-cp314-cp314-win_amd64.whl
Size 2.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
dbca5b3483de6f76626c21a5618b16204ef53bb75f1d6b0ccd04da879b0300c3
BLAKE2b-256 checksum
How to use checksums
9301bf2b4f70942dc39f01b20441d9ff1c134b5450daf1281dbe55ed0e333023
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.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
d8adf88254954f44b57b51ddfd405a400dfaf35c752a70baaac3ffcbc1bb90e5
BLAKE2b-256 checksum
How to use checksums
c2b835d6e99e3d9dd11a3c9b2fd2a40384adc29b741e4d38f9a63fd6c8a5d0c9
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.0-cp313-cp313-win_amd64.whl
Size 2.6 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0c89e991e3d1acfef90f0ff5b989de111887329cc2cbdac28d61b8719cae6f0c
BLAKE2b-256 checksum
How to use checksums
ef7acf3615659af1ccce1dc7472eea66c95d64ab38dfcdba5aa412e884b99eaf
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.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
ce888818de3a9f7b93c0a94a3bc20ea941adb6240fd49e4bc9d803d6a9036015
BLAKE2b-256 checksum
How to use checksums
782552d9281a042f809ae0f7c4ec0780788517d72f2e1f1f0e30cba8797b6586
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.0-cp312-cp312-win_amd64.whl
Size 2.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
b1e823f66c8480dd5d38f06679f943b91e58066f06e96d0fdb00d28b49ce1260
BLAKE2b-256 checksum
How to use checksums
4690380c08a36503382fd577f6452756e8a8c0a589f44a56fa53ab3c6e9f2027
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.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
ca943be47d5cb3b34b2042dae25905557dbd8a72eb01472cdb52c970b1827c31
BLAKE2b-256 checksum
How to use checksums
a48ebc30119673ac161e5cb08b98496002ef68a97f01655c262cb873a9729a34
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.0-cp311-cp311-win_amd64.whl
Size 2.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
51e773a12360dc519a2f96f7f4717f978578efaac61e7d2cc04bf07069bbede0
BLAKE2b-256 checksum
How to use checksums
e5b6a5d0c134ed80515b5355318529ed8a7214258b1b341ead2b6332d1055c64
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 14, 2026.

Transparency log

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

Download URL kiyosi-0.10.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
0bdf78f1d992ce952167048af6b8c329f427bc08aea33a3c312bd99fc26df611
BLAKE2b-256 checksum
How to use checksums
932ae883bc238cbb3bdf5d6bffbc8213603c699726dce28169ee3a76eb7cbf46
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 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.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