QuantLib icon indicating copy to clipboard operation
QuantLib copied to clipboard

OptionletStripper Error When Using SOFR with Volatility Surface

Open chrischang24 opened this issue 6 months ago • 1 comments

Hi, I'm studying how to use QuantLib-Python to price a SOFR cap/floor trade. Initially, pricing with constant volatility works fine. However, when I try to use volatility surface data and create an OptionletVolatilityStructureHandle with the StrippedOptionletAdapter class, I encounter the following error: "RuntimeError: undecidable comparison between 10Y and 3650D."

After tracing the C++ source code, I suspect the root cause is that the optionlet tenors and the cap/floor length are based on the `

`tenor, which is defined as 1D in the Sofr index (see lines 50–55 in optionletstripper.cpp). This results in a mismatch between periods expressed in days and years, leading to a failed comparison and ultimately causing the stripping process to fail.

As a workaround, I defined a new SOFR index using the IborIndex class with a 3M tenor and used it in OptionletStripper1. With this change, the optionlet stripping works correctly.

Since SOFR caplet/floorlet frequency is typically 3M, my suggestion is to consider adding a new parameter (e.g., optionletFrequency) to the OptionletStripper class. This parameter would explicitly define the optionlet frequency for stripping. If not provided, the logic could default to using IborIndex::tenor() as it currently does.

Please find the attached for the issue replication for your reference, thanks.

ql_capfloor_optionlet stripping issue for SOFR option usd_sofr_curve.csv

chrischang24 avatar May 27 '25 07:05 chrischang24

Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it.

boring-cyborg[bot] avatar May 27 '25 07:05 boring-cyborg[bot]

Passing optionletFrequency as a parameter could an idea, we have to see how to do it, to not break other people code. I think OptionletStripper has not been thought for ON indexes at the time.

paolodelia99 avatar Jun 12 '25 12:06 paolodelia99

Fixed by https://github.com/lballabio/QuantLib/pull/2253

lballabio avatar Jul 01 '25 09:07 lballabio

Thanks a lot for the prompt fix! Really appreciate all the effort you put into keeping QuantLib robust and up to date — it’s an invaluable tool for practitioners like me.

chrischang24 avatar Jul 01 '25 11:07 chrischang24