Class CdsMarketQuoteConverter
- java.lang.Object
-
- com.opengamma.strata.pricer.credit.CdsMarketQuoteConverter
-
public class CdsMarketQuoteConverter extends Object
The market quote converter for credit default swaps.
-
-
Field Summary
Fields Modifier and Type Field Description static CdsMarketQuoteConverter
DEFAULT
The default implementation.
-
Constructor Summary
Constructors Constructor Description CdsMarketQuoteConverter()
The default constructor.CdsMarketQuoteConverter(AccrualOnDefaultFormula formula)
The constructor with the accrual-on-default formula specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
cleanPrice(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes the market clean price.double
cleanPriceFromPointsUpfront(double pointsUpfront)
Computes market clean price from points upfront.double
pointsUpfront(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes the points upfront.CdsQuote
pointsUpFrontFromQuotedSpread(ResolvedCdsTrade trade, CdsQuote quote, CreditRatesProvider ratesProvider, ReferenceData refData)
Converts quoted spread to points upfront.CdsQuote
quotedSpreadFromPointsUpfront(ResolvedCdsTrade trade, CdsQuote quote, CreditRatesProvider ratesProvider, ReferenceData refData)
Converts points upfront to quoted spread.List<CdsQuote>
quotesFromParSpread(List<ResolvedCdsTrade> trades, List<CdsQuote> quotes, CreditRatesProvider ratesProvider, CdsQuoteConvention targetConvention, ReferenceData refData)
The par spread quotes are converted to points upfronts or quoted spreads.
-
-
-
Field Detail
-
DEFAULT
public static final CdsMarketQuoteConverter DEFAULT
The default implementation.
-
-
Constructor Detail
-
CdsMarketQuoteConverter
public CdsMarketQuoteConverter()
The default constructor.The original ISDA accrual-on-default formula (version 1.8.2 and lower) is used.
-
CdsMarketQuoteConverter
public CdsMarketQuoteConverter(AccrualOnDefaultFormula formula)
The constructor with the accrual-on-default formula specified.- Parameters:
formula
- the accrual-on-default formula
-
-
Method Detail
-
cleanPriceFromPointsUpfront
public double cleanPriceFromPointsUpfront(double pointsUpfront)
Computes market clean price from points upfront.The points upfront and resultant price are represented as a fraction.
- Parameters:
pointsUpfront
- the points upfront- Returns:
- the clean price
-
cleanPrice
public double cleanPrice(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes the market clean price.The market clean price is usually expressed in percentage. Here a fraction of notional is returned, e.g., 0.98 is 98(%) clean price.
A relevant credit curve must be pre-calibrated and stored in
ratesProvider
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the clean price
-
pointsUpfront
public double pointsUpfront(ResolvedCdsTrade trade, CreditRatesProvider ratesProvider, ReferenceData refData)
Computes the points upfront.The points upfront quote is usually expressed in percentage. Here a fraction of notional is returned, e.g., 0.01 is 1(%) points up-front
The relevant credit curve must be pre-calibrated and stored in
ratesProvider
.- Parameters:
trade
- the traderatesProvider
- the rates providerrefData
- the reference data- Returns:
- the points upfront
-
pointsUpFrontFromQuotedSpread
public CdsQuote pointsUpFrontFromQuotedSpread(ResolvedCdsTrade trade, CdsQuote quote, CreditRatesProvider ratesProvider, ReferenceData refData)
Converts quoted spread to points upfront.Thus
quote
must beCdsQuoteConvention.QUOTED_SPREAD
.The relevant discount curve and recovery rate curve must be stored in
ratesProvider
. The credit curve is internally calibrated to convert one quote type to the other quote type.- Parameters:
trade
- the tradequote
- the quoteratesProvider
- the rates providerrefData
- the reference data- Returns:
- the quote
-
quotedSpreadFromPointsUpfront
public CdsQuote quotedSpreadFromPointsUpfront(ResolvedCdsTrade trade, CdsQuote quote, CreditRatesProvider ratesProvider, ReferenceData refData)
Converts points upfront to quoted spread.Thus
quote
must beCdsQuoteConvention.POINTS_UPFRONT
.The relevant discount curve and recovery rate curve must be stored in
ratesProvider
. The credit curve is internally calibrated to convert one quote type to the other quote type.- Parameters:
trade
- the tradequote
- the quoteratesProvider
- the rates providerrefData
- the reference data- Returns:
- the quote
-
quotesFromParSpread
public List<CdsQuote> quotesFromParSpread(List<ResolvedCdsTrade> trades, List<CdsQuote> quotes, CreditRatesProvider ratesProvider, CdsQuoteConvention targetConvention, ReferenceData refData)
The par spread quotes are converted to points upfronts or quoted spreads.The relevant discount curve and recovery rate curve must be stored in
ratesProvider
. The credit curve is internally calibrated to par spread values.trades
must be sorted in ascending order in maturity and coherent toquotes
.The resultant quote is specified by
targetConvention
.- Parameters:
trades
- the tradesquotes
- the quotesratesProvider
- the rates providertargetConvention
- the target conventionrefData
- the reference data- Returns:
- the quotes
-
-