Skip to content
All library documents

Why QuantLib Interpolates Zero Rates in Continuous Compounding

Article Quant Q&A · Author: Douglas Gagiano

Summary

The note explains a discrepancy between manually interpolated annual-compounded zero rates and rates returned between curve pillars by QuantLib. The key point is that the curve interpolates continuously compounded zero rates, even when its configured day-count and compounding conventions specify annual compounding for reported rates. QuantLib then converts the interpolated value into an implied annual-compounded rate.

The described calculation is to interpolate continuous zero rates, use that rate to form a continuously compounded discount factor, and convert the discount factor back to the requested compounding convention. This explains why direct linear interpolation of annual zero rates can differ slightly from QuantLib’s result and affect swap pricing. The evidence is a manual calculation reported by the question’s author; the note does not provide code, a broader numerical example, or details about overriding discount-factor behavior.

Key ideas

  • QuantLib interpolates continuously compounded zero rates between curve pillars.
  • The interpolated continuous rate is used to calculate a discount factor.
  • QuantLib converts that discount factor to the requested annual-compounded implied rate.
  • Linear interpolation of annual zero rates can therefore produce different results.

Tags

Full text
# Quantlib interpolated zero rates not as expected


# Quantlib interpolated zero rates not as expected












I have created a piecewise linear zero curve using quantlib (c++). It's a NACA, modifiedFollowing swap curve. When I extract the zero rates on the pillar dates the rates line up with what is expected but when I call zero rates in between I get a slightly different linear interpolated rate to what I'm expecting. The discount factors are also different but I read quantlib uses NACC. My question is why are the zero rates different, and for the discount rates which method would I override to use annual compounding for the discount factors? Thanks.

To get a zero rate between pillar dates (benchmark instrument dates) linear interpolation should be used. Using Excel to do this manually I get a different zero rate to quantlib (not far out but starts to differ after the 5th decimal place which has an impact on swap pricing). So either the time period to the interpolated point should be different or quantlib isn't using linear interpolation.

## Answer by Douglas Gagiano (score 2)

https://quant.stackexchange.com/a/74753

Found the answer eventually by manual calculation.

Even if the zero curve is an annual 365F compounded curve, Quantlib works in continuous terms. Therefore the dates between the pillar dates use linear interpolation on continuous zero rates and not compounded zero rates. It does calculate the implied compounded zero rate but in a number of steps:

- Linear interpolate on continuous zeros

- Calculate the discount factor (continuous i.e. exp(-rt))

- Pass compound value (1/df) to implied rate method which converts to annual 365F compounded.

It gives a slightly different answer to when you work with compound zeros only.

Shown 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.