Class YieldCurve

java.lang.Object
com.quantfinlib.rates.YieldCurve

public final class YieldCurve extends Object
Zero-coupon yield curve — the single most load-bearing object in fixed income: every bond price, swap value, forward rate and DV01 is a function of it. The curve stores continuously-compounded ZERO rates at pillar tenors; everything else is derived: the discount factor 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 Type
    Method
    Description
    static YieldCurve
    bootstrapAnnualParSwaps(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).
    double
    discountFactor(double tenorYears)
     
    double
    forwardRate(double fromYears, double toYears)
    Implied continuously-compounded forward rate between two tenors.
    static YieldCurve
    ofZeroRates(double[] tenorYears, double[] zeroRatesCc)
    Curve from parallel arrays of tenors (years) and continuous zero rates.
     
    double
    zeroRate(double tenorYears)
    Continuously-compounded zero rate (linear interpolation, flat extrapolation).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • ofZeroRates

      public static YieldCurve ofZeroRates(double[] tenorYears, double[] zeroRatesCc)
      Curve from parallel arrays of tenors (years) and continuous zero rates.
    • bootstrapAnnualParSwaps

      public static YieldCurve bootstrapAnnualParSwaps(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).
    • 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

      public NavigableSet<Double> tenors()