Skip to content

feat(itofin-py): expose swaption volatility structures to Python#617

Merged
benbenbang merged 3 commits into
mainfrom
fable/612
Jul 27, 2026
Merged

feat(itofin-py): expose swaption volatility structures to Python#617
benbenbang merged 3 commits into
mainfrom
fable/612

Conversation

@benbenbang

@benbenbang benbenbang commented Jul 27, 2026

Copy link
Copy Markdown
Owner
  • feat(itofin-py): expose swaption volatility structures to Python
  • feat(itofin-py): add Black swaption engine bindings
  • test(itofin-py): add tests for black swaption pricing

close #612

This change adds Python bindings for swaption volatility surfaces via the
new `swaptionvol` module, making them available under the `termstructures`
submodule.

**New Python bindings:**
* Added `crates/itofin-py/src/swaptionvol.rs` and registered the new module
  in `lib.rs`, wiring `SwaptionVolatilityStructure`, `VolatilityType`, and
  `ConstantSwaptionVolatility` into the `termstructures` submodule.
* `SwaptionVolatilityStructure` provides the shared `volatility`,
  `black_variance`, and `shift` accessors addressed by option and swap tenor.
* `ConstantSwaptionVolatility` exposes fixed-reference-date constructors,
  including a `with_quote` form that reads volatility from a caller's quote.

**Stub updates:**
* Added hand-written stubs in `termstructures.pyi` for the new classes and
  updated the submodule-to-source maps in `__init__.pyi` and
  `termstructures.pyi` to include `src/vol.rs`, `src/helpers.rs`, and
  `src/swaptionvol.rs`.
This adds Python bindings for pricing swaptions off a swaption volatility
surface instead of a short-rate model.

**New pricing engine module:**
* Added `swaptionengine.rs` exposing `PyBlackSwaptionEngine` and
  `PyCashAnnuityModel`, registered under a new `pricingengines` submodule
  on `itofin`.
* Wired the new submodule into `lib.rs` so it is importable as
  `itofin.pricingengines` alongside the existing eight submodules.

**Swaption pricing update:**
* Added `set_black_engine` to `PySwaption`, letting a swaption price off a
  swaption volatility surface. The engine can be shared across swaptions
  and must carry the same `Settings` object the swaption was built with.

**Type stubs:**
* Added `pricingengines.py` and `pricingengines.pyi`, and updated the
  `__init__.pyi` and `instruments.pyi` stubs to expose the new module and
  the `set_black_engine` method.
@benbenbang
benbenbang enabled auto-merge (rebase) July 27, 2026 03:13
@github-actions github-actions Bot added the enhancement New feature or request label Jul 27, 2026
@benbenbang
benbenbang merged commit f501aab into main Jul 27, 2026
3 of 6 checks passed
@benbenbang
benbenbang deleted the fable/612 branch July 27, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[D7][itofin-py] Pass A1: PySwaptionVolatilityStructure base + PyConstantSwaptionVolatility + PyBlackSwaptionEngine (#605)

1 participant