Workflow to Price a Credit Derivative Instrument
Price and analyze a credit default swap. For more information on the supported credit derivative instruments, see Choose Instruments, Models, and Pricers.
Price CDS
Instrument Using Default Probability Curve and Credit
Pricer
This example shows the workflow to price a CDS
instrument when you use a defprobcurve
model and a Credit
pricing method.
Create CDS
Instrument Object
Use fininstrument
to create a CDS
instrument object.
CDS = fininstrument("CDS",'Maturity',datetime(2021,9,15),'ContractSpread',15,'Notional',20000,'Period',4,'Basis',3,'BusinessDayConvention',"follow",'Name',"CDS_instrument")
CDS = CDS with properties: ContractSpread: 15 Maturity: 15-Sep-2021 Period: 4 Basis: 3 RecoveryRate: 0.4000 BusinessDayConvention: "follow" Holidays: NaT PayAccruedPremium: 1 Notional: 20000 Name: "CDS_instrument"
Create defprobcurve
Object
Create a defprobcurve
object using defprobcurve
.
Settle = datetime(2020,9,20);
DefProbTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])];
DefaultProbabilities = [0.005 0.007 0.01 0.015 0.026 0.04 0.077 0.093 0.15 0.20]';
ProbDates = Settle + DefProbTimes;
DefaultProbCurve = defprobcurve(Settle,ProbDates,DefaultProbabilities,'Basis',5)
DefaultProbCurve = defprobcurve with properties: Settle: 20-Sep-2020 Basis: 5 Dates: [10×1 datetime] DefaultProbabilities: [10×1 double]
Create ratecurve
Object
Create a ratecurve
object using ratecurve
.
Settle = datetime(2020,9,15); Type = 'zero'; ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]'; ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]'; ZeroDates = Settle + ZeroTimes; myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates)
myRC = ratecurve with properties: Type: "zero" Compounding: -1 Basis: 0 Dates: [10×1 datetime] Rates: [10×1 double] Settle: 15-Sep-2020 InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
Create Credit
Pricer Object
Use finpricer
to create a Credit
pricer object and use the ratecurve
object for the 'DiscountCurve'
name-value pair argument.
outPricer = finpricer("credit",'DefaultProbabilityCurve',DefaultProbCurve,'DiscountCurve',myRC)
outPricer = Credit with properties: DiscountCurve: [1×1 ratecurve] TimeStep: 10 DefaultProbabilityCurve: [1×1 defprobcurve]
Price CDS
Instrument
Use price
to compute the price for the CDS
instrument.
Price = price(outPricer,CDS)
Price = 52.7426
See Also
fininstrument
| finmodel
| finpricer