QuantLib SABR Smile Sections: Time Inputs and Volatility Differences
Summary
The question describes problems retrieving an implied volatility smile from a SABR volatility surface through QuantLibXL. A positive time input below one year produces a negative-time error, while another error appears to contradict the function's default extrapolation setting. The user also reports that smile-section volatilities differ from values obtained through a separate volatility-spread function.
The post traces the call into QuantLib's smile-section and term-structure range checks, but it contains no answers resolving the discrepancies. It therefore raises practical issues around time conventions, maximum curve time, extrapolation behavior, and how volatility queries relate to input surface points without establishing their causes. The reported symptoms are specific to the user's setup; the document gives no version details, reproducible data, or tested diagnosis, so it is a troubleshooting prompt rather than a validated explanation.
Key ideas
- The post examines time inputs to SABR smile-section retrieval in QuantLibXL.
- A sub-year input reportedly triggers a negative-time error despite being positive.
- The user questions why a maximum-time error occurs when extrapolation is enabled by default.
- Smile-section volatility results reportedly differ from a separate volatility-spread query.
- The exchange provides no answers or confirmed diagnosis.
Tags
Full text
# When using qlSmileSectionFromSabrVolSurface in Quantlibxl, why the Option Time for input cannot be less than 1?
# When using qlSmileSectionFromSabrVolSurface in Quantlibxl, why the Option Time for input cannot be less than 1?
I constructed a SabrVolSurface in Quantlibxl. Then I wanted to obtain a volatility smile from the surface using qlSmileSectionFromSabrVolSurface. The problem is that the time input is the year-fraction unit, when I input a number which is 0~1, for example 0.4, it shows error: "negative time(-0.594) given".
I went back to the C++ code in Quantlib and found out that qlSmileSectionFromSabrVolSurface calls a function BlackVolSurface::smileSection(Time t, bool extrapolate), and it by default sets the extrapolation as true in qlSmileSectionFromSabrVolSurface. Inside BlackVolSurface::smileSection, it first checks the range of the time, which is
```
void TermStructure::checkRange(Time t,
bool extrapolate) const {
QL_REQUIRE(t >= 0.0,
"negative time (" << t << ") given");
QL_REQUIRE(extrapolate || allowsExtrapolation()
|| t <= maxTime() || close_enough(t, maxTime()),
"time (" << t << ") is past max curve time ("
<< maxTime() << ")");
}
```
I have three main questions that I cannot solve:
- why my input is larger than 0 but the range check says negative time.
- when I input larger than max interpolating time, it says "it passed max curve time", as by default it sets extrapolation as true?
- When I input a time that works, the volatilities it gives are not so aligned with the ones I obtained from qlVolatilitySpreads, where the latter ones are much more close to the actual points.
Really appreciate for the answersShown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.