feat(itofin-py): expose SabrSmileSection to Python#620
Merged
Conversation
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
enabled auto-merge (rebase)
July 27, 2026 03:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #615