Class SwapPricer

java.lang.Object
com.quantfinlib.rates.SwapPricer

public final class SwapPricer extends Object
VANILLA interest-rate swap pricing off the YieldCurve — the missing middle between the curve (which the bootstrap builds FROM par swaps) and RatesOptions (which prices options ON forward swaps): the PV, par rate and DV01 of an actual swap position.

Single-curve identities (annual fixed leg, matching the bootstrap's convention):

   annuity   = sum DF(t_i)                    i = 1..T (annual, tau = 1)
   parRate   = (1 - DF(T)) / annuity          spot-starting
   payerPv   = annuity * (parRate - K)        pay fixed K, receive float
   receiverPv = -payerPv
 

The float leg needs no forecasting in a single-curve world: it is worth par at inception, i.e. 1 - DF(T) per unit notional — which is exactly why the par rate has that closed form. DV01 is the bump-and-reprice sensitivity to a parallel 1bp shift of the zero curve: for a fresh par swap on a flat cc curve it is annuity * e^z * 1bp * notional (the tests pin exactly that; the desk shorthand annuity * 1bp is the sensitivity to the SIMPLE par rate, a different derivative, ~e^z away). A swap struck at the par rate must PV to zero — an identity, tested at 1e-12.

Stated simplifications: single curve (no OIS/projection split), annual fixed leg, spot start. Research lane, deterministic.

  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    annuity(YieldCurve curve, int tenorYears)
    PV of the annual fixed-leg annuity, per unit notional.
    static double
    dv01(YieldCurve curve, int tenorYears, double fixedRate)
    DV01 per unit notional: the payer swap's PV change for a +1bp parallel shift of the zero curve (positive — rates up helps the fixed payer).
    static double
    parRate(YieldCurve curve, int tenorYears)
    The spot-starting par swap rate for tenorYears.
    static double
    payerPv(YieldCurve curve, int tenorYears, double fixedRate)
    PV per unit notional of a PAYER swap (pay fixed fixedRate, receive float).

    Methods inherited from class java.lang.Object

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

    • annuity

      public static double annuity(YieldCurve curve, int tenorYears)
      PV of the annual fixed-leg annuity, per unit notional.
    • parRate

      public static double parRate(YieldCurve curve, int tenorYears)
      The spot-starting par swap rate for tenorYears.
    • payerPv

      public static double payerPv(YieldCurve curve, int tenorYears, double fixedRate)
      PV per unit notional of a PAYER swap (pay fixed fixedRate, receive float). Negate for the receiver.
    • dv01

      public static double dv01(YieldCurve curve, int tenorYears, double fixedRate)
      DV01 per unit notional: the payer swap's PV change for a +1bp parallel shift of the zero curve (positive — rates up helps the fixed payer).