Class IsdaCdsProductPricer


  • public class IsdaCdsProductPricer
    extends java.lang.Object
    Pricer for single-name credit default swaps (CDS) based on ISDA standard model.

    The implementation is based on the ISDA model versions 1.8.2.

    A CDS product is priced based on referenceDate. This is typically valuation date, or settlement date if the product is associated with a Trade.

    • Constructor Detail

      • IsdaCdsProductPricer

        public IsdaCdsProductPricer​(AccrualOnDefaultFormula formula)
        Constructor specifying the formula to use for the accrued on default calculation.

        Options are the formula given in the ISDA model (version 1.8.2 and lower); the proposed fix by Markit (given as a comment in version 1.8.2), or the mathematically correct formula.

        Parameters:
        formula - the formula
    • Method Detail

      • getAccrualOnDefaultFormula

        public AccrualOnDefaultFormula getAccrualOnDefaultFormula()
        Gets the accrual-on-default formula used in this pricer.
        Returns:
        the formula
      • priceSensitivity

        public PointSensitivityBuilder priceSensitivity​(ResolvedCds cds,
                                                        CreditRatesProvider ratesProvider,
                                                        java.time.LocalDate referenceDate,
                                                        ReferenceData refData)
        Calculates the price sensitivity of the product.

        The price sensitivity of the product is the sensitivity of price to the underlying curves.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the present value sensitivity
      • presentValue

        public CurrencyAmount presentValue​(ResolvedCds cds,
                                           CreditRatesProvider ratesProvider,
                                           java.time.LocalDate referenceDate,
                                           PriceType priceType,
                                           ReferenceData refData)
        Calculates the present value of the CDS product.

        The present value of the product is based on referenceDate. This is typically the valuation date, or cash settlement date if the product is associated with a Trade.

        This method can calculate the clean or dirty present value, see PriceType. If calculating the clean value, the accrued interest is calculated based on the step-in date.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        priceType - the price type
        refData - the reference data
        Returns:
        the present value
      • presentValueSensitivity

        public PointSensitivityBuilder presentValueSensitivity​(ResolvedCds cds,
                                                               CreditRatesProvider ratesProvider,
                                                               java.time.LocalDate referenceDate,
                                                               ReferenceData refData)
        Calculates the present value sensitivity of the product.

        The present value sensitivity of the product is the sensitivity of present value to the underlying curves.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the present value sensitivity
      • parSpread

        public double parSpread​(ResolvedCds cds,
                                CreditRatesProvider ratesProvider,
                                java.time.LocalDate referenceDate,
                                ReferenceData refData)
        Calculates the par spread of the CDS product.

        The par spread is a coupon rate such that the clean PV is 0. The result is represented in decimal form.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the par spread
      • parSpreadSensitivity

        public PointSensitivityBuilder parSpreadSensitivity​(ResolvedCds cds,
                                                            CreditRatesProvider ratesProvider,
                                                            java.time.LocalDate referenceDate,
                                                            ReferenceData refData)
        Calculates the par spread sensitivity of the product.

        The par spread sensitivity of the product is the sensitivity of par spread to the underlying curves. The resulting sensitivity is based on the currency of the CDS product.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the par spread
      • protectionLeg

        public double protectionLeg​(ResolvedCds cds,
                                    CreditRatesProvider ratesProvider,
                                    java.time.LocalDate referenceDate,
                                    ReferenceData refData)
        Calculates the price of the protection leg, which is the protection leg present value per unit notional.
        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the protection leg price
      • riskyAnnuity

        public double riskyAnnuity​(ResolvedCds cds,
                                   CreditRatesProvider ratesProvider,
                                   java.time.LocalDate referenceDate,
                                   PriceType priceType,
                                   ReferenceData refData)
        Calculates the risky annuity, which is RPV01 per unit notional.
        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        priceType - the price type
        refData - the reference data
        Returns:
        the risky annuity
      • rpv01

        public CurrencyAmount rpv01​(ResolvedCds cds,
                                    CreditRatesProvider ratesProvider,
                                    java.time.LocalDate referenceDate,
                                    PriceType priceType,
                                    ReferenceData refData)
        Calculates the risky PV01 of the CDS product.

        RPV01 is defined as minus of the present value sensitivity to coupon rate.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        priceType - the price type
        refData - the reference date
        Returns:
        the RPV01
      • recovery01

        public CurrencyAmount recovery01​(ResolvedCds cds,
                                         CreditRatesProvider ratesProvider,
                                         java.time.LocalDate referenceDate,
                                         ReferenceData refData)
        Calculates the recovery01 of the CDS product.

        The recovery01 is defined as the present value sensitivity to the recovery rate. Since the ISDA standard model requires the recovery rate to be constant throughout the lifetime of the CDS, one currency amount is returned by this method.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the recovery01
      • jumpToDefault

        public JumpToDefault jumpToDefault​(ResolvedCds cds,
                                           CreditRatesProvider ratesProvider,
                                           java.time.LocalDate referenceDate,
                                           ReferenceData refData)
        Calculates the jump-to-default of the CDS product.

        The jump-to-default is the value of the product in case of immediate default.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        referenceDate - the reference date
        refData - the reference data
        Returns:
        the jump-to-default
      • expectedLoss

        public CurrencyAmount expectedLoss​(ResolvedCds cds,
                                           CreditRatesProvider ratesProvider)
        Calculates the expected loss of the CDS product.

        The expected loss is the (undiscounted) expected default settlement value paid by the protection seller. The resulting value is always positive.

        Parameters:
        cds - the product
        ratesProvider - the rates provider
        Returns:
        the expected loss