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.
ContractSpreadBP = 0; % Contractual spread is determined on ExerciseDate CDS = fininstrument("CDS",'Maturity',datetime(2027,9,20),'ContractSpread',ContractSpreadBP)
CDS = CDS with properties: ContractSpread: 0 Maturity: 20-Sep-2027 Period: 4 Basis: 2 RecoveryRate: 0.4000 BusinessDayConvention: "actual" Holidays: NaT PayAccruedPremium: 1 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 CDSOption array with properties:
OptionType
Strike
Knockout
AdjustedForwardSpread
ExerciseDate
CDS
Name
⋮
ReceiverCDSOptions = fininstrument("CDSOption",'Strike',Strikes,'ExerciseDate',ExerciseDate,'OptionType',"put",'CDS',CDS)
ReceiverCDSOptions=31×1 CDSOption array with properties:
OptionType
Strike
Knockout
AdjustedForwardSpread
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.
SpreadVolatility = 0.3; CDSOptionModel = finmodel("CDSBlack",'SpreadVolatility',SpreadVolatility)
CDSOptionModel = CDSBlack with properties: SpreadVolatility: 0.3000
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
⋮
ReceiverPrices = price(CDSOptionpricer,ReceiverCDSOptions)
ReceiverPrices = 31×1
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; plot(Strikes, PayerPrices, '--', Strikes, ReceiverPrices) title('CDS Option Pricing') xlabel('Option Strike (Basis Points)') ylabel('Option Premium (Basis Points)') legend('Payer CDS Options','Receiver CDS Options','Location','best')