Class CreditSpreads

java.lang.Object
com.quantfinlib.credit.CreditSpreads

public final class CreditSpreads extends Object
BOND credit-spread measures — the translation layer between a bond's PRICE and how much of it is credit.

The Z-SPREAD is the single constant shift z added to every point of the risk-free zero curve that makes the bond's discounted cash flows equal its dirty price:

  price = sum cf_i * exp(-(z(t_i) + z) * t_i)

It is the honest successor to "yield spread over the 10y": a yield spread compares one bond's YTM to one government point and mixes curve shape into the number; the Z-spread strips the entire risk-free curve out first, so what remains is compensation for credit and liquidity. A desk triangulates it against the same name's CDS: zSpread - cdsParSpread is the CDS-BOND BASIS, the classic relative-value trade (negative basis: buy the bond, buy CDS protection, collect the difference — a trade that famously blew through funding constraints in 2008, which is why the basis is not free money).

Solving is bisection on z in [-50%, +500%] with an explicit bracket check: a price outside what that range can explain throws rather than returning an endpoint (the house rule for every solver since the YTM incident). Annual-fraction period grid i/frequency, cash flows of a standard fixed-coupon bond. Research lane, deterministic.

  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    priceWithZSpread(double face, double couponRate, int frequency, double yearsToMaturity, YieldCurve curve, double z)
    Bond PV under the curve shifted by a constant z (cc).
    static double
    zSpread(double dirtyPrice, double face, double couponRate, int frequency, double yearsToMaturity, YieldCurve curve)
    The Z-spread (continuously compounded, decimal) of a fixed-coupon bond over curve.

    Methods inherited from class java.lang.Object

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

    • zSpread

      public static double zSpread(double dirtyPrice, double face, double couponRate, int frequency, double yearsToMaturity, YieldCurve curve)
      The Z-spread (continuously compounded, decimal) of a fixed-coupon bond over curve.
      Parameters:
      dirtyPrice - market dirty price per face
      face - face value, > 0
      couponRate - annual coupon rate (decimal)
      frequency - coupons per year, ≥ 1
      yearsToMaturity - whole periods assumed, > 0
    • priceWithZSpread

      public static double priceWithZSpread(double face, double couponRate, int frequency, double yearsToMaturity, YieldCurve curve, double z)
      Bond PV under the curve shifted by a constant z (cc).