Class YieldCurve
DF(t) = e^{-z(t)·t} answers "what is 1 unit at time t worth
today", and the implied forward between t1 and t2 falls out of the
ratio of discount factors — the market's own break-even rate for that
future period, no forecast involved.
You rarely observe zero rates directly; the market quotes PAR
instruments (deposits, swaps). Bootstrapping walks the quotes from
shortest to longest, at each pillar solving for the one discount factor
that reprices the quote given the factors already solved — for annual
par swaps, DF_n = (1 - parRate_n · A_{n-1}) / (1 + parRate_n)
with A the annuity so far. The result reprices every input
exactly (tested), which is the definition of a usable curve.
Model choices, stated: linear interpolation ON ZERO RATES (simple, fast, and the standard first choice; its known wart is small forward-rate kinks at pillars — smoothing splines fix that at the cost of locality), flat extrapolation beyond the pillars, and one curve for both discounting and projection (pre-2008 style; a multi-curve OIS/projection split is a composition of two of these). Research/warm lane.
-
Method Summary
Modifier and TypeMethodDescriptionstatic YieldCurvebootstrapAnnualParSwaps(int[] tenorYears, double[] parRates) Classic bootstrap from par swap rates with an annual fixed leg at integer-year pillars (missing years are filled by linear interpolation of the par rates):DF_n = (1 - parRate_n * A_{n-1}) / (1 + parRate_n).doublediscountFactor(double tenorYears) doubleforwardRate(double fromYears, double toYears) Implied continuously-compounded forward rate between two tenors.static YieldCurveofZeroRates(double[] tenorYears, double[] zeroRatesCc) Curve from parallel arrays of tenors (years) and continuous zero rates.tenors()doublezeroRate(double tenorYears) Continuously-compounded zero rate (linear interpolation, flat extrapolation).
-
Method Details
-
ofZeroRates
Curve from parallel arrays of tenors (years) and continuous zero rates. -
bootstrapAnnualParSwaps
Classic bootstrap from par swap rates with an annual fixed leg at integer-year pillars (missing years are filled by linear interpolation of the par rates):DF_n = (1 - parRate_n * A_{n-1}) / (1 + parRate_n). -
zeroRate
public double zeroRate(double tenorYears) Continuously-compounded zero rate (linear interpolation, flat extrapolation). -
discountFactor
public double discountFactor(double tenorYears) -
forwardRate
public double forwardRate(double fromYears, double toYears) Implied continuously-compounded forward rate between two tenors. -
tenors
-