Skip to content
All library documents

Using QuantLib Helpers to Bootstrap Swap Curves

Article Quant Q&A · Author: user3296

Summary

The document describes how to bootstrap a Chinese renminbi interest-rate curve from a short deposit quote and Shibor-linked swap rates in QuantLib. It uses deposit and swap rate helpers to build a piecewise cubic zero curve, then obtains zero rates at the curve dates and converts them to equivalent rates for reporting. The example specifies conventions including the calendar, payment frequency, day-count basis, and index used by the swaps.

The answer identifies implementation mistakes that prevent the example from running as intended: an already-created index object should be passed directly rather than called like a function, and day-counter types such as Actual/360 must be instantiated wherever used. It also moves the equivalent-rate calculation inside the loop so each date contributes its own reported spot rate. The material is a practical API and curve-construction correction, not a discussion of whether the chosen market conventions or interpolation method best fit a particular trading or valuation use case.

Key ideas

  • Build the curve from deposit and swap rate helpers tied to the appropriate index and market conventions.
  • Pass the constructed Shibor index object directly to the swap helper.
  • Instantiate day counters wherever QuantLib expects a day-counter object.
  • Calculate and store an equivalent spot rate separately for each curve date.

Tags

Full text
# QuantLib and exact numerical simulation


# QuantLib and exact numerical simulation












I've just downloaded quantlib and started playing around with it, and it looks like it's designed primarily to use Euler discretizations for everything -- so far as I can tell, there's not even a method provided to exactly simulate geometric Brownian motion. Am I missing an obvious feature? If not, is there a fundamental reason why you wouldn't (ever) want to use exact numerics instead of approximate ones?

## Answer by Luigi Ballabio (score 12, accepted)

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

Well, actually it's designed to use whatever discretization you throw at it---but for the time being only Euler discretization is implemented, mostly for lack of time or interest on the part of contributors. If you want to use exact numerics with a process, you can just code the corresponding discretization class (you'll have to inherit from `StochasticProcess::discretization`) and pass an instance of your class to the process upon instantiation. The whole design is described in more detail in chapter 6 at http://implementingquantlib.blogspot.com/p/the-book.html, or rather, the half of chapter 6 I've written so far.

Needless to say, if you do write exact discretization, send a patch our way and we'll include it in the library.

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.