# Price Multiple CDS Option Instruments Using CDS Black Model and CDS Black Pricer

This example shows the workflow to price multiple CDSOption instruments using a CDSBlack model and a CDSBlack pricer.

### Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2021,9,20);
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;
ZeroCurve = ratecurve("zero", Settle, ZeroDates ,ZeroRates)
ZeroCurve =
ratecurve with properties:

Type: "zero"
Compounding: -1
Basis: 0
Dates: [10x1 datetime]
Rates: [10x1 double]
Settle: 20-Sep-2021
InterpMethod: "linear"
ShortExtrapMethod: "next"
LongExtrapMethod: "previous"

### Create defprobcurve Object

Create a defprobcurve object using defprobcurve.

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)
DefaultProbCurve =
defprobcurve with properties:

Settle: 20-Sep-2021
Basis: 2
Dates: [10x1 datetime]
DefaultProbabilities: [10x1 double]

### Create CDS Instrument Object

Use fininstrument to create an underlying CDS instrument object.

CDS =
CDS with properties:

Maturity: 20-Sep-2027
Period: 4
Basis: 2
RecoveryRate: 0.4000
Holidays: NaT
Notional: 10000000
Name: ""

### Create CDSOption Instrument Objects

Use fininstrument to create multiple CDSOption instrument objects.

ExerciseDate = datetime(2021, 12, 20);
Strikes = [30:2:90]';
PayerCDSOptions = fininstrument("CDSOption",'Strike',Strikes,'ExerciseDate',ExerciseDate,'OptionType',"call",'CDS',CDS)
PayerCDSOptions=31×1 object
16x1 CDSOption array with properties:

OptionType
Strike
Knockout
ExerciseDate
CDS
Name
⋮

16x1 CDSOption array with properties:

OptionType
Strike
Knockout
ExerciseDate
CDS
Name
⋮

### Price CDSOption Instruments

Assuming a flat volatility structure across strikes, first use finmodel to create a CDSBlack model object. Then use finpricer to create a CDSBlack pricer object. Use price to compute the prices for the CDSOption instruments.

CDSOptionModel =
CDSBlack with properties:

CDSOptionpricer = finpricer("analytic",'Model',CDSOptionModel,'DiscountCurve',ZeroCurve,'DefaultProbabilityCurve',DefaultProbCurve)
CDSOptionpricer =
CDSBlack with properties:

Model: [1x1 finmodel.CDSBlack]
DiscountCurve: [1x1 ratecurve]
DefaultProbabilityCurve: [1x1 defprobcurve]

PayerPrices = price(CDSOptionpricer,PayerCDSOptions)
PayerPrices = 31×1

171.7269
160.6802
149.6346
138.5931
127.5648
116.5716
105.6576
94.8983
84.4061
74.3266
⋮

0.0000
0.0003
0.0016
0.0070
0.0256
0.0794
0.2123
0.4999
1.0547
2.0221
⋮

### Plot CDS Option Prices

Plot the payer and receiver CDS option prices.

figure;