Skip to main content

Kiyosi

简体中文 | English

Kiyosi 是一个用 Rust 编写的衍生品定价库,提供 Python API。它支持 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.15.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.15.0
File Size Uploaded Provenance Actions
kiyosi-0.15.0.tar.gz 1.2 MB With provenance Details for kiyosi-0.15.0.tar.gz

Built distributions (wheels)

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

Total release size: 18.9 MB

Release files / kiyosi-0.15.0.tar.gz

Download URL kiyosi-0.15.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
006187210a6feb7462bb7cdf4c7dfce4a658e916aded75206599570713391770
BLAKE2b-256 checksum
How to use checksums
87441a06e227ae5b45d7c799dd486b64ca69de0df8e170bbbf9844baa0bfceaf
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.0-cp315-cp315-win_amd64.whl
Size 1.7 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
05036ff7289beb363f225a76e8455c9afe7ad3de14a5c2df4fe2bf7ca46fc3c4
BLAKE2b-256 checksum
How to use checksums
e5c7241e91e4d225ade489465d3ccb9762893c2ee124d8f122b1efff1b7d373a
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.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
4c42bbde4d0fef89c90349cb789bf25e9ce56149dbaf92d06826e930acfa255c
BLAKE2b-256 checksum
How to use checksums
f3092ba80e5ac5e37b375173658d3c0208ebf7e68bab412eecd97aa9ca06b468
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.0-cp314-cp314-win_amd64.whl
Size 1.7 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
6d55aef45a02057930810d9d5bbfe0b4c38b043fc7d3248a4e81564cdfc92457
BLAKE2b-256 checksum
How to use checksums
0a25d0a2fcb8d7478d0465638f4daca15abcb1550359b1d3dda422d81b1768c2
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.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
7cf32bc2efbe94469b36036428a8fc0c642c98a39ba44ac6eebf7f41a09512a0
BLAKE2b-256 checksum
How to use checksums
8083916cdc9c4f03c6bfbf5c67f6906c0b4cc8752a182093f3a18c2f46904afe
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.0-cp313-cp313-win_amd64.whl
Size 1.7 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
cc63d9fe80a02e809af4f6a25e8c4857959c3cabd6e590dcdb35fb6d220b9bcb
BLAKE2b-256 checksum
How to use checksums
906ac9e98d24ad16cfa5bd28f83384fc8463579949996df0c72b922a81c5561a
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.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
cddaa4981cd7e0c8b065dccbbca209e9f12c813f3d9ba64ddf6278a56f16202c
BLAKE2b-256 checksum
How to use checksums
ea482a0c66c2adce8eadf3d953c003a7bed32ab464f475bef7a72640cf99419e
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.0-cp312-cp312-win_amd64.whl
Size 1.7 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
bd2cdbc1dcb10b7e0c04d25c23c4e27da7d18179bd00dca3717679abd4ade3ea
BLAKE2b-256 checksum
How to use checksums
270bc730e1253d112b672c77956a7b4e5c067b86b137818ca8954774a6bfe1b9
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.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
2288cbd750377df567235ef87c88738906b1440eadba41641922712a529047aa
BLAKE2b-256 checksum
How to use checksums
931e5fc812e00782f1fcad0ce487adc8586e1f839af523bb19c48ee6584d85f4
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.0-cp311-cp311-win_amd64.whl
Size 1.7 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2bb71125b137252b822a01913e7b0f24b75a9132673cd07b219bb67cf28d0b99
BLAKE2b-256 checksum
How to use checksums
25a46afe654ae85e346572385d0388b94b7db53c930b1298312a372283b2ef47
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 31, 2026.

Transparency log

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

Download URL kiyosi-0.15.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
af7e937f53340ac700ba67937ea5155b6e40fdaaccf6689ec45c05734e78af3b
BLAKE2b-256 checksum
How to use checksums
6535cb672c06213ba75b8aea85009480b9264b94013918b85bffbe47d0fb4542
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 31, 2026.

Transparency log

Security for kiyosi 0.15.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.15.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 31, 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