Skip to content

feat(itofin-py): expose SabrSmileSection to Python#620

Merged
benbenbang merged 4 commits into
mainfrom
fable/615
Jul 27, 2026
Merged

feat(itofin-py): expose SabrSmileSection to Python#620
benbenbang merged 4 commits into
mainfrom
fable/615

Conversation

@benbenbang

@benbenbang benbenbang commented Jul 27, 2026

Copy link
Copy Markdown
Owner
  • feat(itofin-py): expose SabrSmileSection to Python
  • feat(itofin-py): expose SabrSwaptionVolatilityCube facade
  • test(itofin-py): add SABR swaption cube tests
  • docs(itofin-py): document ZABR/XABR and recalibration limits for SABR cube

close #615

Add a new `SabrSmileSection` class that evaluates one option expiry's
volatility smile from the closed-form Hagan SABR formula at fixed
parameters, with no calibration. It exposes `volatility` and `variance`
queries and read-only accessors for the exercise time, ATM level, and
SABR parameters.

* Add `smilesection.rs` and register `PySabrSmileSection` under the
  `termstructures` module in `lib.rs`.
* Add hand-written stubs for `SabrSmileSection` in `termstructures.pyi`
  and note the new source file in the sync comment.
* Make `PyVolatilityType::inner` crate-visible so the smile section can
  reuse it.
* Update the deferred-work issue reference in `swaptionengine.rs`.
This pull request adds a Python facade for the calibrated SABR swaption
volatility cube, wiring it through the module registration and type stubs.

**New SABR cube facade:**
* Added `PySabrSwaptionVolatilityCube` in `swaptionvol.rs`, a smile cube whose
  every node is a SABR smile fitted to the at-the-money volatility plus the
  market vol spreads, calibrated by Levenberg-Marquardt on construction.
* The constructor validates that `vol_spreads` and `parameters_guess` are
  row-major over the `(option tenor, swap tenor)` nodes and that
  `is_parameter_fixed` carries one flag per SABR parameter, erroring ahead of
  the core's dimension checks.
* Exposed `atm_strike_from_tenor`, returning the strike the fitted smile is
  centred on for a given option and swap tenor.
* Added a shared `node_grid` helper that checks the node row count and the
  fixed column count before converting a quote grid to core handles.

**Registration and stubs:**
* Registered `PySabrSwaptionVolatilityCube` in the `termstructures` module in
  `lib.rs`.
* Added the `SabrSwaptionVolatilityCube` class definition to
  `termstructures.pyi`.
Add a new test module for the SABR swaption cube in the itofin-py
crate to verify its behavior.

Closes #615
… cube

Clarify the scope of the SABR swaption vol cube bindings in both the Rust
docstring and the Python stub. Note that ZABR and the generic XABR cube
are a separate core track (#597) and are not bound here, and that the
section-recalibration API is unported in the core, so callers must re-fit
by bumping the guess or vol-spread quotes.

close #615
@benbenbang
benbenbang enabled auto-merge (rebase) July 27, 2026 03:27
@github-actions github-actions Bot added the enhancement New feature or request label Jul 27, 2026
@benbenbang
benbenbang merged commit 1c380d7 into main Jul 27, 2026
3 of 6 checks passed
@benbenbang
benbenbang deleted the fable/615 branch July 27, 2026 03:30
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 A4: PySabrSmileSection + PySabrSwaptionVolatilityCube (#605)

1 participant