Skip to main content

Kiyosi

简体中文 | English

Kiyosi 是以 Rust 为核心的 Python 衍生品定价库,支持 Black–Scholes–Merton 模型下的香草及奇异期权定价、希腊值计算和隐含参数求解。

支持的产品与算法

金融产品 定价算法
欧式香草期权 BSM 解析解、CRR、数值积分、FD、MC
美式香草期权 Bjerksund–Stensland 2002 近似、CRR、FD、最小二乘 MC
数字期权(现金或资产支付) 解析解、CRR、数值积分、FD、MC
几何平均亚式期权 连续平均解析解、MC
算术平均亚式期权 Turnbull–Wakeman 连续平均近似、MC
单障碍期权 解析法、CRR、数值积分、FD、MC
双障碍期权 解析级数、FD、MC
二元障碍、单触碰与单不触碰期权 解析法、FD
双触碰与双不触碰期权 FD
雪球、二元雪球、三元雪球 数值积分、FD、MC
凤凰结构 数值积分、FD、MC
累购/累沽 数值积分、FD、MC
区间累计 BSM 区间概率解析求和

安装

需要 Python 3.11+:

python -m pip install kiyosi

wheel 安装无需 Rust;源码安装需 Rust/Cargo 和本机编译工具。

快速上手

使用有限差分(FD)引擎为标准雪球定价:

from datetime import date

from kiyosi.instruments import standard_snowball
from kiyosi.market import (
    BlackScholesMertonParameters,
    PricingContext,
    monthly_schedule,
    weekdays_calendar,
)
from kiyosi.pricing import FiniteDifferenceAutocallableEngine

start, end = date(2025, 1, 2), date(2026, 1, 2)
calendar = weekdays_calendar()
observations = monthly_schedule(
    start=start,
    end=end,
    first_observation_month=1,
    calendar=calendar,
)
snowball = standard_snowball(
    coupon_rate=0.12,
    initial_spot=100.0,
    knock_in_level=80.0,
    knock_out_level=103.0,
    observation_dates=observations,
    effective_date=start,
    expiry_date=end,
)
context = PricingContext(
    model_parameters=BlackScholesMertonParameters(
        risk_free_rate=0.02,
        dividend_yield=0.00,
        volatility=0.20,
    ),
    spot_price=100.0,
    valuation_time=start,
    calendar=calendar,
)
engine = FiniteDifferenceAutocallableEngine(
    asset_step_count=800,
    time_step_count=2000,
    scheme="crank_nicolson",
)
price = engine.price(snowball, context)
notional = 1_000_000
print(f"NPV / notional: {price:.6f}")
print(f"NPV: {price * notional:,.2f}")

许可证

MIT

Metadata

Release files for kiyosi 0.14.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.14.0
File Size Uploaded Provenance Actions
kiyosi-0.14.0.tar.gz 1.1 MB With provenance Details for kiyosi-0.14.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kiyosi 0.14.0
File Actions
kiyosi-0.14.0-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for kiyosi-0.14.0-cp315-cp315-win_amd64.whl
kiyosi-0.14.0-cp315-cp315-manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ x86-64 Details for kiyosi-0.14.0-cp315-cp315-manylinux_2_28_x86_64.whl
kiyosi-0.14.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for kiyosi-0.14.0-cp314-cp314-win_amd64.whl
kiyosi-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for kiyosi-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl
kiyosi-0.14.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for kiyosi-0.14.0-cp313-cp313-win_amd64.whl
kiyosi-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for kiyosi-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl
kiyosi-0.14.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for kiyosi-0.14.0-cp312-cp312-win_amd64.whl
kiyosi-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for kiyosi-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl
kiyosi-0.14.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for kiyosi-0.14.0-cp311-cp311-win_amd64.whl
kiyosi-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for kiyosi-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl

Total release size: 19.0 MB

Release files / kiyosi-0.14.0.tar.gz

Download URL kiyosi-0.14.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
201b4b155cbe0bf620b7080f0ebd18cd1317fe9d56ff50ee8dc4acd9e6155c46
BLAKE2b-256 checksum
How to use checksums
0c6f71763e5fd482e644141c591fd15e46123ca71da180d7a97580ae097b244b
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 30, 2026.

Transparency log

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

Download URL kiyosi-0.14.0-cp315-cp315-win_amd64.whl
Size 1.7 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
c9f0d0cb2a838968612f15dad9f4c38a5c5742b4737cdb6292b11a975215175a
BLAKE2b-256 checksum
How to use checksums
f88181a7c963ddbaa26bc0fba9699429369e69d809d9b04b077f2ea5f0eaac70
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 30, 2026.

Transparency log

Release files / kiyosi-0.14.0-cp315-cp315-manylinux_2_28_x86_64.whl

Download URL kiyosi-0.14.0-cp315-cp315-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.15 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c15faaa128ae67d6fc2a9fe8fab73cdd99c292540ef763fc9bf999fd1f4759fb
BLAKE2b-256 checksum
How to use checksums
c0404894679fed311e02d3d0eec9fd2b38279f883f4411f690e464f6a1bbcba6
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 30, 2026.

Transparency log

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

Download URL kiyosi-0.14.0-cp314-cp314-win_amd64.whl
Size 1.7 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
e0ff3f4cac74f55ccfd69fcb4449621e37a9dd8679e2fbea2056ff64e18d178c
BLAKE2b-256 checksum
How to use checksums
114d9292b1dad6c6f45cdffdc8a36aaaf09fee0a07d5c36d9760742f0318eede
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 30, 2026.

Transparency log

Release files / kiyosi-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL kiyosi-0.14.0-cp314-cp314-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
32626f6b4432eaa66dccfeedd4b3db55e2c5c79a2b13b52ac4fc97bd254a98bf
BLAKE2b-256 checksum
How to use checksums
1744c088526808b19cdcc6db36bc6ac83854bdf8e2e576e50613f9513232f796
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 30, 2026.

Transparency log

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

Download URL kiyosi-0.14.0-cp313-cp313-win_amd64.whl
Size 1.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
8befb5b323f6b94fd4e9b1a5207f7c9dd8b751e745a7fead7cfcea401e428618
BLAKE2b-256 checksum
How to use checksums
d83ed560b58bd0f72b8aad8250ff8885a967c934ca9058499cc9080819e2b131
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 30, 2026.

Transparency log

Release files / kiyosi-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL kiyosi-0.14.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ee2c200c96df0102495dbe23c7e51ed84faf77567182b1d6f954e5466f910c4a
BLAKE2b-256 checksum
How to use checksums
c897ce3e99b96d6302c19ef379c536ce49fe610f978d0645feb0566a470c00da
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 30, 2026.

Transparency log

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

Download URL kiyosi-0.14.0-cp312-cp312-win_amd64.whl
Size 1.7 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
4ff8356452f8d3f9b3c78c537c7603696452b3e0fba8678a64b1c48ce06514c6
BLAKE2b-256 checksum
How to use checksums
e9b35d2fdaf050c56268cac94db216b9cf67ef0c29ab76fa14a277fa0e3b22e1
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 30, 2026.

Transparency log

Release files / kiyosi-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL kiyosi-0.14.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e000525975b8f662704c6197871e03759fafa099457dedfb658702af7f351e6d
BLAKE2b-256 checksum
How to use checksums
13f065d5576c5a108a656b9f5aab9d69404aa9ac15a9b2e719f9ab3dc875b05c
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 30, 2026.

Transparency log

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

Download URL kiyosi-0.14.0-cp311-cp311-win_amd64.whl
Size 1.7 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
b4c1398d7a5cf9742ba85577725428e6874c4df121dbe0f87aed33bea1535878
BLAKE2b-256 checksum
How to use checksums
d59f163223733721b4a5a1abf1637a5f553dd446d574a5477c3fb3b3ef623f01
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 30, 2026.

Transparency log

Release files / kiyosi-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL kiyosi-0.14.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ecf4063fb73653388f3f40123ff1ced4fee753238e7a7e6b3314bb896059c1a6
BLAKE2b-256 checksum
How to use checksums
2d01c3a671dff4019f0c075ee4f61cadd0b1669bb8ebff0e9ca9d17d763eec09
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 30, 2026.

Transparency log

Security for kiyosi 0.14.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.14.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 30, 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