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.12.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.12.0
File Size Uploaded Provenance Actions
kiyosi-0.12.0.tar.gz 479.2 kB With provenance Details for kiyosi-0.12.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kiyosi 0.12.0
File Actions
kiyosi-0.12.0-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for kiyosi-0.12.0-cp315-cp315-win_amd64.whl
kiyosi-0.12.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 for kiyosi-0.12.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
kiyosi-0.12.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for kiyosi-0.12.0-cp314-cp314-win_amd64.whl
kiyosi-0.12.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 for kiyosi-0.12.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
kiyosi-0.12.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for kiyosi-0.12.0-cp313-cp313-win_amd64.whl
kiyosi-0.12.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 for kiyosi-0.12.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
kiyosi-0.12.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for kiyosi-0.12.0-cp312-cp312-win_amd64.whl
kiyosi-0.12.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 for kiyosi-0.12.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
kiyosi-0.12.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for kiyosi-0.12.0-cp311-cp311-win_amd64.whl
kiyosi-0.12.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 for kiyosi-0.12.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 31.4 MB

Release files / kiyosi-0.12.0.tar.gz

Download URL kiyosi-0.12.0.tar.gz
Size 479.2 kB
Tags Source
SHA-256 checksum
How to use checksums
25c5c7bab5d8e2ca2e017b501522a37c30872292bb762f86f0848570daf1d361
BLAKE2b-256 checksum
How to use checksums
a288c264a28eca157793036bf649a5e8bbfcd6a585486c2104a5af11c3c4a31f
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp315-cp315-win_amd64.whl
Size 3.1 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
0f4bdd6492c980d9540cbaad505031c3fd67bd2b9d0e614d57ad67455abe34d7
BLAKE2b-256 checksum
How to use checksums
394050dcb45d1d6f067a394d6eef2ca1c5ebd0c5f22a15172d30ea4678126fab
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.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
0a6d61318ecca6c14de5a57dd3380cd27adfe9c0e562979988255b930d8833bb
BLAKE2b-256 checksum
How to use checksums
303d337e6cf708f7c596209e9b3ab35f4a28f47e181f7abbc68da2846df1f7e0
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp314-cp314-win_amd64.whl
Size 3.1 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
d276d9551d79e8a6e769a1a19dd4b2cab7aeded1843c0cac80fbad74fc69e867
BLAKE2b-256 checksum
How to use checksums
a15ee32d697aa37284dabd4e49983a885cb09fdcbe6c0279df06e2e6b4a920ba
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.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
fcad0ee8841fd0524b234410bf3d8501e67f9dde3b40cc88742d7d6ea0882e9b
BLAKE2b-256 checksum
How to use checksums
62ac1c288568bf69b02650183dbe02b90d34793f4984b6eb3d6515a8a763c378
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp313-cp313-win_amd64.whl
Size 3.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
4257b60ab4fe18a978ae9e38a7e9caaf74fe4521c0d0eb4fa2889162a2961513
BLAKE2b-256 checksum
How to use checksums
80f37c6aed5770c85b5dc559f55165ecbda8a325ebaf1db310df54c2b1663cec
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.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
4bc44324fcf3c5c4f89222f47eceeabc9c04fcd1a78a4a61d5f0d9e117ae70f6
BLAKE2b-256 checksum
How to use checksums
61715221e0497dd9c593595d1f5f0327c3569895bf799c882d71b19607505269
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp312-cp312-win_amd64.whl
Size 3.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
c04dd2baec303f278c1f1e62e2189213683fb5401d472ee86c9542e2f3ecdc40
BLAKE2b-256 checksum
How to use checksums
4cdda7da0f62c4f3bacd47ce7aee3be211b0a01afe7c4cb066696545601c84ec
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.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
d6dafff61f00af7b5796d3ad3c47dda5368dde2bbbcf1e9a1fdcb0ad10c7c113
BLAKE2b-256 checksum
How to use checksums
54bf31bf10f503a5365d9873cff070fd98ee424b36b6584216bc83c7e577c881
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp311-cp311-win_amd64.whl
Size 3.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9bc0e0deb4ca5e3d3a4869083b80a6fad381178901376ebca7cc413eaa8dc84a
BLAKE2b-256 checksum
How to use checksums
e46b9522455d6a21d73ba03f7380c406fcdb950cba3c1a76710b615d283b7a58
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 23, 2026.

Transparency log

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

Download URL kiyosi-0.12.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.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
e2f41404bf1f0838ff0f7cfd9928d33e3da730e034b82697f55f852bc122ddb1
BLAKE2b-256 checksum
How to use checksums
94b3a3a1a3715926659fd9d8b9cd0fd0ac917899d079e2bb12f364067b817fde
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 23, 2026.

Transparency log

Security for kiyosi 0.12.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.

Select from 11 files

Attestation for kiyosi-0.12.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 23, 2026.

Transparency log

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

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