Curves
A yield curve gives discount factors, zero rates and forward rates from its reference date. FlatForward is the
simplest; a bootstrapped curve fits the market's quotes.
Bootstrapping
Each quote becomes a rate helper: a deposit, a FRA, a futures contract, a swap or an overnight swap. The piecewise curve finds, pillar by pillar, the values that reprice every helper. This one bootstraps a Euribor 6M curve from two deposits and eight swaps, on illustrative quotes:
(int Years, double Rate)[] swapQuotes =
[(2, 0.0225), (3, 0.0232), (5, 0.0245), (7, 0.0256), (10, 0.0270), (15, 0.0283), (20, 0.0288), (30, 0.0285)];
RateHelper[] helpers =
[
new DepositRateHelper(0.0205 + shift, new Euribor(new Period(3, TimeUnit.Months)), context),
new DepositRateHelper(0.0210 + shift, new Euribor6M(), context),
.. swapQuotes.Select(q =>
new SwapRateHelper(q.Rate + shift, new EuriborSwapIsdaFixA(new Period(q.Years, TimeUnit.Years)), context)),
];
var curve = new PiecewiseLogLinearDiscount(today, helpers, new Actual365Fixed(), context);
A helper takes its quote as a number and the context it is dated in. The curve runs its bootstrap when it is built, and is immutable from then on: a new quote means a new curve.
The curve's name gives what it interpolates and how. PiecewiseLogLinearDiscount interpolates the log of the discount
factors linearly; PiecewiseLinearZero, PiecewiseCubicZero, PiecewiseFlatForward and the rest are QuantLib's
other choices, and PiecewiseYieldCurve<TTraits, TInterpolator, TBootstrap> takes them as type arguments. The
GlobalPiecewise curves fit every pillar at once, with QuantLib's global bootstrap.
Reading it
DayCounter dc = new Actual365Fixed();
foreach (int years in new[] { 1, 2, 5, 10, 20, 25 })
{
Date d = Today + new Period(years, TimeUnit.Years);
double discount = curve.Discount(d);
double zero = curve.ZeroRate(d, dc, Compounding.Continuous).Rate;
double forward = curve.ForwardRate(d, d + new Period(6, TimeUnit.Months), new Actual360(), Compounding.Simple).Rate;
table.Add($"{years}Y", Table.D(d), Table.N(discount, 6), Table.Percent(zero), Table.Percent(forward));
}
| Tenor | Date | Discount | Zero rate | 6M forward |
|---|---|---|---|---|
| 1Y | 2027-10-15 | 0.978380 | 2.1857% | 2.2388% |
| 2Y | 2028-10-15 | 0.956486 | 2.2214% | 2.4126% |
| 5Y | 2031-10-15 | 0.885807 | 2.4238% | 2.7943% |
| 10Y | 2036-10-15 | 0.764483 | 2.6833% | 3.0842% |
| 20Y | 2046-10-15 | 0.562262 | 2.8770% | 2.7046% |
| 25Y | 2051-10-15 | 0.490797 | 2.8450% | 2.6977% |
ZeroRate and ForwardRate return an InterestRate, the rate with its day counter, compounding and frequency.
Other curves
- Multi-curve: an €STR curve for discounting and a Euribor curve bootstrapped on it, each swap helper given the discounting curve (multi-curve bootstrapping).
- Interpolated curves from given nodes:
InterpolatedDiscountCurve<TInterpolator>,InterpolatedZeroCurve<TInterpolator>,InterpolatedForwardCurve<TInterpolator>. - Spreaded curves over another curve:
ZeroSpreadedTermStructure,ForwardSpreadedTermStructure, and the piecewise spreads. - Fitted bond curves, the Nelson-Siegel family and splines:
FittedBondDiscountCurvewith its fitting methods.