Class CdsPricer

java.lang.Object
com.quantfinlib.credit.CdsPricer

public final class CdsPricer extends Object
CDS pricing off a CreditCurve: the two legs, the par spread, and the upfront that post-2009 standardized contracts actually exchange.

A credit default swap is insurance with a running premium: the protection BUYER pays spread per year (quarterly, accruing to the default date) and receives 1 - R of notional if the name defaults before maturity. The pricing identities, per unit notional:

   riskyAnnuity  = sum dt * DF(t_i) * Q(t_i)  +  accrual-on-default term
   premiumLegPv  = spread * riskyAnnuity
   protectionPv  = (1 - R) * sum DF(t_i) * (Q(t_{i-1}) - Q(t_i))
   parSpread     = protectionPv / riskyAnnuity     (zero-upfront spread)
   upfront(S_c)  = protectionPv - S_c * riskyAnnuity
 

Positive upfront means the protection buyer pays points up front (the contract's fixed coupon S_c is too small for the risk — the standard 100bp coupon on a 300bp name). The risky annuity is also the desk's "risky DV01": the PnL per 1bp of spread move, which is why it gets its own accessor rather than living inside the leg. Same quarterly discretization as the bootstrap, stated there. Research lane, deterministic.

  • Method Details

    • riskyAnnuity

      public static double riskyAnnuity(CreditCurve credit, YieldCurve discount, double maturityYears)
      PV of 1bp-per-year premium stream per unit spread (the risky annuity / risky DV01 base).
    • premiumLegPv

      public static double premiumLegPv(CreditCurve credit, YieldCurve discount, double spread, double maturityYears)
      PV of the premium leg at the given running spread.
    • protectionLegPv

      public static double protectionLegPv(CreditCurve credit, YieldCurve discount, double maturityYears)
      PV of the protection leg: (1-R) paid at default.
    • parSpread

      public static double parSpread(CreditCurve credit, YieldCurve discount, double maturityYears)
      The zero-upfront (par) spread for this maturity.
    • upfront

      public static double upfront(CreditCurve credit, YieldCurve discount, double contractSpread, double maturityYears)
      Upfront points (per unit notional) the protection BUYER pays on a contract with fixed running coupon contractSpread.