Package net.finmath.marketdata.model.cds
Class CDS
- java.lang.Object
-
- net.finmath.marketdata.products.AbstractAnalyticProduct
-
- net.finmath.marketdata.model.cds.CDS
-
- All Implemented Interfaces:
AnalyticProduct,Product
public class CDS extends AbstractAnalyticProduct implements AnalyticProduct
Implements the valuation of a CDS (fixed-fee CDS, floating-fee CDS, with upfront or without) from the perspective of the protection buyer with unit notional of 1 using curves:- a forward curve, if the bond has floating rate coupons
- a discount curve as a base curve for discounting
- a survival probability curve for additional credit risk related discount factor
- a recovery rate curve to model a non-constant recovery rate term-structure
ScheduleFromPeriods.- Author:
- Matthias Föhr, Christian Fries
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCDS.DirtyCleanPricestatic classCDS.ValuationModel
-
Constructor Summary
Constructors Constructor Description CDS(ScheduleFromPeriods schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double floatingFeeSpread, double upfrontPayment, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)Creates a CDS with a floating fee, with upfront.CDS(ScheduleFromPeriods schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double floatingFeeSpread, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)Creates a CDS with a floating fee, no upfront.CDS(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double fixedFee, double upfrontPayment, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)Creates a CDS with a fixed fee, with upfront.CDS(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double fixedFee, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)Creates a CDS with a fixed fee, no upfront.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetAccruedFee(double time, AnalyticModelFromCurvesAndVols model)Returns the accrued interest of the bond for a given time.doublegetAccruedFee(LocalDate date, AnalyticModel model)Returns the accrued fee of the CDS for a given date.doublegetConventionalSpread(double evaluationTime, AnalyticModel calibratedModelJPM)Calculates the conventional CDS spread, i.e.CDS.DirtyCleanPricegetDirtyCleanPrice()StringgetDiscountCurveName()doublegetFeePayment(int periodIndex, AnalyticModel model)Returns the CDS fee payment of the period with the given index.doublegetFixedFee()doublegetFloatingFeeSpread()StringgetForwardCurveName()StringgetRecoveryRateCurveName()SchedulegetSchedule()StringgetSurvivalProbabilityCurveName()LocalDategetTradeDate()doublegetUpfrontPayment()CDS.ValuationModelgetValuationModel()doublegetValue(double evaluationTime, AnalyticModel model)Evaluates the CDS at the evaluationTime according to a Analytic Model.booleanisUseFinerDiscretization()StringtoString()-
Methods inherited from class net.finmath.marketdata.products.AbstractAnalyticProduct
getValue, getValue
-
-
-
-
Constructor Detail
-
CDS
public CDS(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double fixedFee, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)
Creates a CDS with a fixed fee, no upfront.- Parameters:
schedule- Schedule of the CDS.discountCurveName- Name of the discount curve.survivalProbabilityCurveName- Name of the survival probability curve.recoveryRateCurveName- Name of the Recovery Rate CurveFromInterpolationPoints (1 Recovery Rate for each timestep in the scheduleFromPeriods).fixedFee- The fixed fee of the CDS expressed as absolute value.tradeDate- Trading Date of the CDS contractvaluationModel- Defines the valuation model used (DISCRETE, JPM, JPM_NOACCFEE)dirtyCleanPrice- Defines if CLEAN or DIRTY price is considereduseFinerDiscretization- Boolean if finer Discretization (discountCurve Dates + CDS Dates) is used
-
CDS
public CDS(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double fixedFee, double upfrontPayment, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)
Creates a CDS with a fixed fee, with upfront.- Parameters:
schedule- Schedule of the CDS.discountCurveName- Name of the discount curve.survivalProbabilityCurveName- Name of the survival probability curve.recoveryRateCurveName- Name of the Recovery Rate CurveFromInterpolationPoints (1 Recovery Rate for each timestep in the scheduleFromPeriods).fixedFee- The fixed fee of the CDS expressed as absolute value.tradeDate- Trading Date of the CDS contractupfrontPayment- The initial upfront payment of the CDS from the perspective of the protection buyer(Nonzero if fee != conventional CDS spread).valuationModel- Defines the valuation model used (DISCRETE, JPM, JPM_NOACCFEE)dirtyCleanPrice- Defines if CLEAN or DIRTY price is considereduseFinerDiscretization- Boolean if finer Discretization (discountCurve Dates + CDS Dates) is used
-
CDS
public CDS(ScheduleFromPeriods schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double floatingFeeSpread, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)
Creates a CDS with a floating fee, no upfront.- Parameters:
schedule- Schedule of the CDS.discountCurveName- Name of the discount curve.forwardCurveName- Name of the forward curve, leave empty if this is a fixed fee CDSsurvivalProbabilityCurveName- Name of the survival probability curve.recoveryRateCurveName- Name of the Recovery Rate CurveFromInterpolationPoints (1 Recovery Rate for each timestep in the scheduleFromPeriods).floatingFeeSpread- The floating fee spread of the CDS expressed as absolute value.tradeDate- Trading Date of the CDS contractvaluationModel- Defines the valuation model used (DISCRETE, JPM, JPM_NOACCFEE)dirtyCleanPrice- Defines if CLEAN or DIRTY price is considereduseFinerDiscretization- Boolean if finer Discretization (discountCurve Dates + CDS Dates) is used
-
CDS
public CDS(ScheduleFromPeriods schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String recoveryRateCurveName, double floatingFeeSpread, double upfrontPayment, LocalDate tradeDate, CDS.ValuationModel valuationModel, CDS.DirtyCleanPrice dirtyCleanPrice, boolean useFinerDiscretization)
Creates a CDS with a floating fee, with upfront.- Parameters:
schedule- Schedule of the CDS.discountCurveName- Name of the discount curve.forwardCurveName- Name of the forward curve, leave empty if this is a fixed fee CDSsurvivalProbabilityCurveName- Name of the survival probability curve.recoveryRateCurveName- Name of the Recovery Rate CurveFromInterpolationPoints (1 Recovery Rate for each timestep in the scheduleFromPeriods).floatingFeeSpread- The floating fee spread of the CDS expressed as absolute value.upfrontPayment- The initial upfront payment of the CDS from the perspective of the protection buyer(Nonzero if fee != conventional CDS spread).tradeDate- Trading Date of the CDS contractvaluationModel- Defines the valuation model used (DISCRETE, JPM, JPM_NOACCFEE)dirtyCleanPrice- Defines if CLEAN or DIRTY price is considereduseFinerDiscretization- Boolean if finer Discretization (discountCurve Dates + CDS Dates) is used
-
-
Method Detail
-
getValue
public double getValue(double evaluationTime, AnalyticModel model)Evaluates the CDS at the evaluationTime according to a Analytic Model.- Specified by:
getValuein interfaceAnalyticProduct- Parameters:
evaluationTime- Evaluation time of the pricing.model- Analytic Model, within the CDS is priced.- Returns:
- The value of the product using the given model.
-
getConventionalSpread
public double getConventionalSpread(double evaluationTime, AnalyticModel calibratedModelJPM)Calculates the conventional CDS spread, i.e. the fee payment such that the CDS is valued at 0 (and no upfront). Treats conventional CDS spread as a FIXED fee, not floating.- Parameters:
evaluationTime- Evaluation time of the pricing.calibratedModelJPM- Analytic Model, within the CDS is priced.- Returns:
- The conventional CDS spread.
-
getFeePayment
public double getFeePayment(int periodIndex, AnalyticModel model)Returns the CDS fee payment of the period with the given index. The analytic model is needed in case of a floating fee.- Parameters:
periodIndex- The index of the period of interest.model- The model under which the product is valued.- Returns:
- The value of the fee payment in the given period.
-
getAccruedFee
public double getAccruedFee(LocalDate date, AnalyticModel model)
Returns the accrued fee of the CDS for a given date.- Parameters:
date- The date of interest.model- The model under which the product is valued.- Returns:
- The accrued fee.
-
getAccruedFee
public double getAccruedFee(double time, AnalyticModelFromCurvesAndVols model)Returns the accrued interest of the bond for a given time.- Parameters:
time- The time of interest as double.model- The model under which the product is valued.- Returns:
- The accrued interest.
-
getSchedule
public Schedule getSchedule()
-
getDiscountCurveName
public String getDiscountCurveName()
-
getForwardCurveName
public String getForwardCurveName()
-
getSurvivalProbabilityCurveName
public String getSurvivalProbabilityCurveName()
-
getRecoveryRateCurveName
public String getRecoveryRateCurveName()
-
getFixedFee
public double getFixedFee()
-
getFloatingFeeSpread
public double getFloatingFeeSpread()
-
getUpfrontPayment
public double getUpfrontPayment()
-
getTradeDate
public LocalDate getTradeDate()
-
getValuationModel
public CDS.ValuationModel getValuationModel()
-
getDirtyCleanPrice
public CDS.DirtyCleanPrice getDirtyCleanPrice()
-
isUseFinerDiscretization
public boolean isUseFinerDiscretization()
-
-