Class IsdaCdsProductPricer
- java.lang.Object
-
- com.opengamma.strata.pricer.credit.IsdaCdsProductPricer
-
public class IsdaCdsProductPricer extends 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 aTrade
.
-
-
Field Summary
Fields Modifier and Type Field Description static IsdaCdsProductPricer
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description IsdaCdsProductPricer(AccrualOnDefaultFormula formula)
Constructor specifying the formula to use for the accrued on default calculation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurrencyAmount
expectedLoss(ResolvedCds cds, CreditRatesProvider ratesProvider)
Calculates the expected loss of the CDS product.AccrualOnDefaultFormula
getAccrualOnDefaultFormula()
Gets the accrual-on-default formula used in this pricer.JumpToDefault
jumpToDefault(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the jump-to-default of the CDS product.double
parSpread(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the par spread of the CDS product.PointSensitivityBuilder
parSpreadSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the par spread sensitivity of the product.CurrencyAmount
presentValue(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the present value of the CDS product.PointSensitivityBuilder
presentValueSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the present value sensitivity of the product.double
price(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the price of the CDS product, which is the present value per unit notional.PointSensitivityBuilder
priceSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the price sensitivity of the product.double
protectionLeg(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the price of the protection leg, which is the protection leg present value per unit notional.CurrencyAmount
recovery01(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the recovery01 of the CDS product.double
riskyAnnuity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the risky annuity, which is RPV01 per unit notional.PointSensitivityBuilder
riskyAnnuitySensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the risky annuity sensitivity of the product.CurrencyAmount
rpv01(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the risky PV01 of the CDS product.
-
-
-
Field Detail
-
DEFAULT
public static final IsdaCdsProductPricer DEFAULT
Default implementation.
-
-
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
-
price
public double price(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the price of the CDS product, which is the present value per unit notional.This method can calculate the clean or dirty price, see
PriceType
. If calculating the clean price, the accrued interest is calculated based on the step-in date.This is coherent with
presentValue(ResolvedCds, CreditRatesProvider, LocalDate, PriceType, ReferenceData)
.- Parameters:
cds
- the productratesProvider
- the rates providerreferenceDate
- the reference datepriceType
- the price typerefData
- the reference data- Returns:
- the price
-
priceSensitivity
public PointSensitivityBuilder priceSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the present value sensitivity
-
presentValue
public CurrencyAmount presentValue(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 aTrade
.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 productratesProvider
- the rates providerreferenceDate
- the reference datepriceType
- the price typerefData
- the reference data- Returns:
- the present value
-
presentValueSensitivity
public PointSensitivityBuilder presentValueSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the present value sensitivity
-
parSpread
public double parSpread(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the par spread
-
parSpreadSensitivity
public PointSensitivityBuilder parSpreadSensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the par spread
-
protectionLeg
public double protectionLeg(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the price of the protection leg, which is the protection leg present value per unit notional.- Parameters:
cds
- the productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the protection leg price
-
riskyAnnuity
public double riskyAnnuity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData)
Calculates the risky annuity, which is RPV01 per unit notional.Zero is returned if the CDS already expired.
- Parameters:
cds
- the productratesProvider
- the rates providerreferenceDate
- the reference datepriceType
- the price typerefData
- the reference data- Returns:
- the risky annuity
-
riskyAnnuitySensitivity
public PointSensitivityBuilder riskyAnnuitySensitivity(ResolvedCds cds, CreditRatesProvider ratesProvider, LocalDate referenceDate, ReferenceData refData)
Calculates the risky annuity sensitivity of the product.The risky annuity sensitivity of the product is the sensitivity of risky annuity to the underlying curves. The resulting sensitivity is based on the currency of the CDS product.
Empty sensitivity is returned if the CDS already expired.
- Parameters:
cds
- the productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the risky annuity sensitivity
-
rpv01
public CurrencyAmount rpv01(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference datepriceType
- the price typerefData
- the reference date- Returns:
- the RPV01
-
recovery01
public CurrencyAmount recovery01(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- the reference data- Returns:
- the recovery01
-
jumpToDefault
public JumpToDefault jumpToDefault(ResolvedCds cds, CreditRatesProvider ratesProvider, 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 productratesProvider
- the rates providerreferenceDate
- the reference daterefData
- 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 productratesProvider
- the rates provider- Returns:
- the expected loss
-
-