Class SpreadSensitivityCalculator
- java.lang.Object
-
- com.opengamma.strata.pricer.credit.SpreadSensitivityCalculator
-
- Direct Known Subclasses:
AnalyticSpreadSensitivityCalculator
,FiniteDifferenceSpreadSensitivityCalculator
public abstract class SpreadSensitivityCalculator extends Object
The spread sensitivity calculator.The spread sensitivity, also called CS01, is the sensitivity of the CDS product present value to par spreads of the bucket CDSs. The bucket CDSs do not necessarily correspond to the node point of the input credit curve.
-
-
Constructor Summary
Constructors Constructor Description SpreadSensitivityCalculator(AccrualOnDefaultFormula formula)
Constructor with accrual-on-default formula.
-
Method Summary
-
-
-
Constructor Detail
-
SpreadSensitivityCalculator
public SpreadSensitivityCalculator(AccrualOnDefaultFormula formula)
Constructor with accrual-on-default formula.- Parameters:
formula
- the accrual-on-default formula
-
-
Method Detail
-
getPricer
protected IsdaCdsTradePricer getPricer()
Gets the pricer.- Returns:
- the pricer
-
getCalibrator
protected IsdaCompliantCreditCurveCalibrator getCalibrator()
Gets the calibrator.- Returns:
- the calibrator
-
parallelCs01
public CurrencyAmount parallelCs01(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes parallel CS01 for CDS.The relevant credit curve must be stored in
RatesProvider
.The CDS trades used in the curve calibration are reused as bucket CDS by this method. Thus the credit curve must store
ResolvedTradeParameterMetadata
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the parallel CS01
-
parallelCs01
public abstract CurrencyAmount parallelCs01(ResolvedCdsTrade trade, List<ResolvedCdsTrade> bucketCds, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes parallel CS01 for CDS.The relevant credit curve must be stored in
RatesProvider
.- Parameters:
trade
- the tradebucketCds
- the CDS bucketratesProvider
- the rates providerrefData
- the reference data- Returns:
- the parallel CS01
-
bucketedCs01
public CurrencyParameterSensitivity bucketedCs01(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes bucketed CS01 for CDS.The relevant credit curve must be stored in
RatesProvider
.The CDS trades used in the curve calibration are reused as bucket CDS by this method. Thus the credit curve must store
ResolvedTradeParameterMetadata
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the bucketed CS01
-
bucketedCs01
public CurrencyParameterSensitivity bucketedCs01(ResolvedCdsTrade trade, List<ResolvedCdsTrade> bucketCds, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes bucketed CS01 for CDS.The relevant credit curve must be stored in
RatesProvider
.- Parameters:
trade
- the tradebucketCds
- the CDS bucketratesProvider
- the rates providerrefData
- the reference data- Returns:
- the bucketed CS01
-
parallelCs01
public CurrencyAmount parallelCs01(ResolvedCdsIndexTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes parallel CS01 for CDS index using a single credit curve.This is coherent to the pricer
IsdaHomogenousCdsIndexTradePricer
. The relevant credit curve must be stored inRatesProvider
.The CDS index trades used in the curve calibration are reused as bucket CDS index by this method. Thus the credit curve must store
ResolvedTradeParameterMetadata
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the parallel CS01
-
parallelCs01
public CurrencyAmount parallelCs01(ResolvedCdsIndexTrade trade, List<ResolvedCdsIndexTrade> bucketCdsIndex, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes parallel CS01 for CDS index using a single credit curve.This is coherent to the pricer
IsdaHomogenousCdsIndexTradePricer
. The relevant credit curve must be stored inRatesProvider
.- Parameters:
trade
- the tradebucketCdsIndex
- the CDS index bucketratesProvider
- the rates providerrefData
- the reference data- Returns:
- the parallel CS01
-
bucketedCs01
public CurrencyParameterSensitivity bucketedCs01(ResolvedCdsIndexTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes bucketed CS01 for CDS index using a single credit curve.This is coherent to the pricer
IsdaHomogenousCdsIndexTradePricer
. The relevant credit curve must be stored inRatesProvider
.The CDS index trades used in the curve calibration are reused as bucket CDS index by this method. Thus the credit curve must store
ResolvedTradeParameterMetadata
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the bucketed CS01
-
bucketedCs01
public CurrencyParameterSensitivity bucketedCs01(ResolvedCdsIndexTrade trade, List<ResolvedCdsIndexTrade> bucketCdsIndex, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes bucketed CS01 for CDS index using a single credit curve.This is coherent to the pricer
IsdaHomogenousCdsIndexTradePricer
. The relevant credit curve must be stored inRatesProvider
.- Parameters:
trade
- the tradebucketCdsIndex
- the CDS index bucketratesProvider
- the rates providerrefData
- the reference data- Returns:
- the bucketed CS01
-
checkCdsBucket
protected void checkCdsBucket(ResolvedCdsTrade trade, List<ResolvedCdsTrade> bucketCds)
-
impliedSpread
protected DoubleArray impliedSpread(List<ResolvedCdsTrade> bucketCds, CreditRatesProvider ratesProvider, ReferenceData refData)
-
-