feat(itofin-py): add SwapIndex Python binding - #619
Merged
Merged
Conversation
This pull request exposes the core swap index to Python, so the volatility cubes can read the at-the-money forward from a vanilla swap's fair rate. **New SwapIndex binding:** * Added `crates/itofin-py/src/swapindex.rs` defining `PySwapIndex`, assembled from the index tenor, forecasting Euribor index, and fixed-leg conventions. * Registered `PySwapIndex` in the `indexes` module in `src/lib.rs`. * Supports both the default constructor (forecasting and discounting off the ibor index's forwarding curve) and `with_exogenous_discount` (discounting off a separate curve), plus `fixing`, `fixed_leg_tenor`, and `exogenous_discount` inspectors. **Supporting changes:** * Added a `PyPeriod::from_inner` helper in `src/time.rs` for inspectors that return a `Period`. * Extended the hand-written stubs in `indexes.pyi` with the `SwapIndex` type and its new imports.
This adds a Python binding for the smile cube that layers bilinearly-interpolated volatility spreads over an at-the-money surface. **New volatility cube facade:** * Added `PyInterpolatedSwaptionVolatilityCube` in `swaptionvol.rs`, extending `PySwaptionVolatilityStructure` so the inherited `volatility` query takes a real strike, reading the at-the-money forward and vol off the base swap indexes and `atm_vol` and adding the interpolated spread. * Validated the `vol_spreads` grid shape here, enforcing one row per `(option tenor, swap tenor)` node and one column per strike spread, and wired the quotes into the core cube. * Exposed `atm_strike_from_tenor` on the concrete cube to serve the at-the-money strike a caller needs to place a smile query. **Registration and supporting changes:** * Registered the new class in the `termstructures` module in `lib.rs`. * Dropped the `dead_code` allowance on `PySwapIndex::inner`, now consumed by the cube facade. * Added hand-written stubs for `InterpolatedSwaptionVolatilityCube` in `termstructures.pyi`.
benbenbang
enabled auto-merge (rebase)
July 27, 2026 03:24
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 #614