Main Content

CDSBlack

Create CDSBlack pricer object for CDSOption instrument using CDSBlack model

Since R2020a

Description

Create and price a CDSOption instrument object with a CDSBlack model and a CDSBlack pricing method using this workflow:

  1. Use fininstrument to create the CDSOption instrument object. By default, this creates a single-name CDS option. You can create a CDS index option by specifying the optional name-value argument AdjustedForwardSpread.

  2. Use finmodel to specify the CDSBlack model for the CDSOption instrument object.

  3. Use finpricer to specify the CDSBlack pricer object for the CDSOption instrument object.

For more information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available instruments, models, and pricing methods for a CDSOption instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

CDSBlackPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_obj,'Model',model,'DefaultProbabilityCurve',defaultprobabilitycurve_obj) creates a CDSBlack pricer object by specifying PricerType and the required name-value pair arguments for DiscountCurve, Model, and DefaultProbabilityCurve to set properties using name-value pairs. For example, CDSBlackPricerObj = finpricer("Analytic",'Model',CDSBlack,'DiscountCurve',ratecurve_obj,'DefaultProbabilityCurve',defaultprobabilitycurve_obj) creates a CDSBlack pricer object.

example

Input Arguments

expand all

Pricer type, specified as a string with the value of "Analytic" or the character vector with a value of 'Analytic'.

Data Types: char | string

Name-Value Arguments

Specify required pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: CDSBlackPricerObj = finpricer("Analytic",'Model',CDSBlack,'DiscountCurve',ratecurve_obj,'DefaultProbabilityCurve',defaultprobabilitycurve_obj)

Required CDSBlack Name-Value Pair Arguments

expand all

ratecurve object for discounting cash flows, specified as the comma-separated pair consisting of 'DiscountCurve' and the name of the previously created ratecurve object.

Data Types: object

Model object, specified as the comma-separated pair consisting of 'Model' and the name of a previously created CDSBlack model object using finmodel.

Data Types: object

Default probability curve, specified as the comma-separated pair consisting of 'DefaultProbabilityCurve' and a name of a previously created defprobcurve.

Data Types: object

Properties

expand all

ratecurve object for discounting cash flows, returned as the ratecurve object.

Data Types: object

Model, returned as a CDSBlack model object.

Data Types: object

Default probability curve, returned as a defprobcurve object.

Data Types: object

Object Functions

priceCompute price for interest-rate, equity, or credit derivative instrument with Analytic pricer

Examples

collapse all

This example shows the workflow to price a CDSOption instrument when you use a CDSBlack model and a CDSBlack pricing method.

Create ratecurve Object

Create a ratecurve object using ratecurve.

Settle = datetime(2017,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-2017
         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-2017
                   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 Object

Use fininstrument to create a CDSOption instrument object.

ExerciseDate = datetime(2017, 12, 20);
Strike = 50;
CDSOption = fininstrument("CDSOption",'Strike',Strike,'ExerciseDate',ExerciseDate,'OptionType',"put",'CDS',CDS)
CDSOption = 
  CDSOption with properties:

               OptionType: "put"
                   Strike: 50
                 Knockout: 0
    AdjustedForwardSpread: NaN
             ExerciseDate: 20-Dec-2017
                      CDS: [1x1 fininstrument.CDS]
                     Name: ""

Create CDSBlack Model Object

Use finmodel to create a CDSBlack model object.

SpreadVolatility = 0.3;
CDSOptionModel = finmodel("CDSBlack",'SpreadVolatility',SpreadVolatility)
CDSOptionModel = 
  CDSBlack with properties:

    SpreadVolatility: 0.3000

Create CDSBlack Pricer Object

Use finpricer to create a CDSBlack pricer object and use the ratecurve object for the 'DiscountCurve' name-value pair argument.

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

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

Price CDSOption Instrument

Use price to compute the price for the CDSOption instrument.

outPrice = price(CDSOptionpricer,CDSOption)
outPrice = 
6.5054

This example shows the workflow to use a CDSOption instrument to price CDS index options when you use a CDSBlack model and a CDSBlack pricing method.

Set Up Data for CDS Index

% CDS index and option data
Recovery = .4;
Basis = 2;
Period = 4;
CDSMaturity = datetime(2017, 6, 20);
ContractSpread = 100;
IndexSpread = 140;
BusDayConvention = 'follow';
Settle = datetime(2012, 4, 13);
OptionMaturity = datetime(2012, 6, 20);
OptionStrike = 140;
SpreadVolatility = .69;

Create ratecurve Object for Zero Curve Using irbootstrap

Create ratecurve object for a zero curve using irbootstrap.

% Zero curve data
DepRates = [0.004111 0.00563 0.00757 0.01053]';
DepTimes = calmonths([1 2 3 6]');
DepDates = Settle + DepTimes;
nDeposits = length(DepTimes);

SwapRates = [0.01387 0.01035 0.01145 0.01318 0.01508 0.01700 0.01868 ...
    0.02012 0.02132 0.02237 0.02408 0.02564 0.02612 0.02524]';
SwapTimes = calyears([1 2 3 4 5 6 7 8 9 10 12 15 20 30]');
SwapDates = Settle + SwapTimes;
nSwaps = length(SwapTimes);

nInst = nDeposits + nSwaps;

BootInstruments(nInst,1) = fininstrument.FinInstrument;
for ii=1:length(DepDates)
    BootInstruments(ii) = fininstrument("deposit","Maturity",DepDates(ii),"Rate",DepRates(ii));
end

for ii=1:length(SwapDates)
    BootInstruments(ii+nDeposits) = fininstrument("swap","Maturity",SwapDates(ii),"LegRate",[SwapRates(ii) 0]);
end

ZeroCurve = irbootstrap(BootInstruments,Settle)
ZeroCurve = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: -1
                Basis: 0
                Dates: [18x1 datetime]
                Rates: [18x1 double]
               Settle: 13-Apr-2012
         InterpMethod: "linear"
    ShortExtrapMethod: "next"
     LongExtrapMethod: "previous"

Bootstrap Default Probability Curve

Use defprobstrip to bootstrap default probability curve assuming a flat index spread.

ProbDates = datemnth(OptionMaturity,(0:5*12)');
MarketCDSInstruments = fininstrument("cds", ...
    'ContractSpread', ContractSpread, 'Maturity', CDSMaturity);
DefaultProbCurve = defprobstrip(ZeroCurve, MarketCDSInstruments, IndexSpread, 'ProbDates', ProbDates)
DefaultProbCurve = 
  defprobcurve with properties:

                  Settle: 13-Apr-2012
                   Basis: 2
                   Dates: [61x1 datetime]
    DefaultProbabilities: [61x1 double]

Compute Spot and Forward RPV01s

Compute the spot and forward RPV01s using cdsrpv01.

ProbData = [datenum(DefaultProbCurve.Dates) DefaultProbCurve.DefaultProbabilities];

% RPV01(t,T)
RPV01_CDSMaturity = cdsrpv01(ZeroCurve,ProbData,Settle,CDSMaturity)
RPV01_CDSMaturity = 
4.7853
% RPV01(t,t_E,T)
RPV01_OptionExpiryForward = cdsrpv01(ZeroCurve,ProbData,Settle,CDSMaturity,...
    'StartDate',OptionMaturity)
RPV01_OptionExpiryForward = 
4.5972
% RPV01(t,t_E) = RPV01(t,T) - RPV01(t,t_E,T)
RPV01_OptionExpiry = RPV01_CDSMaturity - RPV01_OptionExpiryForward
RPV01_OptionExpiry = 
0.1882

Compute Spot Spreads

Compute the spot spreads using cdsspread.

% S(t,t_E)
Spread_OptionExpiry = cdsspread(ZeroCurve,ProbData,Settle,OptionMaturity,...
    'Period',Period,'Basis',Basis,'BusDayConvention',BusDayConvention,...
    'PayAccruedPremium',true,'recoveryrate',Recovery)
Spread_OptionExpiry = 
139.8995
% S(t,T)
Spread_CDSMaturity = cdsspread(ZeroCurve,ProbData,Settle,CDSMaturity,...
    'Period',Period,'Basis',Basis,'BusDayConvention',BusDayConvention,...
    'PayAccruedPremium',true,'recoveryrate',Recovery)
Spread_CDSMaturity = 
139.9999

Compute Forward Spread

Compute the forward spread using the spot spreads and RPV01s.

% F = S(t,t_E,T)
ForwardSpread = (Spread_CDSMaturity.*RPV01_CDSMaturity - Spread_OptionExpiry.*RPV01_OptionExpiry)./RPV01_OptionExpiryForward
ForwardSpread = 
140.0040

Compute Front-End Protection

Compute the front-end protection (FEP).

FEP = 10000*(1-Recovery)*ZeroCurve.discountfactors(OptionMaturity)*DefaultProbCurve.DefaultProbabilities(1)
FEP = 
26.3108

Compute Adjusted Forward Spread

Compute the adjusted forward spread to use when creating an CDSOption instrument.

AdjustedForwardSpread = ForwardSpread + FEP./RPV01_OptionExpiryForward
AdjustedForwardSpread = 
145.7273

Compute CDS Option Prices with Adjusted Forward Spread

Use fininstrument to create a CDSOption instrument for a single-name CDS option.

CDS = fininstrument("cds",'ContractSpread', ContractSpread, 'Maturity', CDSMaturity)
CDS = 
  CDS with properties:

           ContractSpread: 100
                 Maturity: 20-Jun-2017
                   Period: 4
                    Basis: 2
             RecoveryRate: 0.4000
    BusinessDayConvention: "actual"
                 Holidays: NaT
        PayAccruedPremium: 1
                 Notional: 10000000
                     Name: ""

Use fininstrument to create a CDSOption instrument for two CDS index option instruments.

CDSCallOption = fininstrument("cdsoption", 'Strike', OptionStrike, ...
    'ExerciseDate', OptionMaturity, 'OptionType', 'call', 'CDS', CDS, ...
    'Knockout',true, 'AdjustedForwardSpread', AdjustedForwardSpread)
CDSCallOption = 
  CDSOption with properties:

               OptionType: "call"
                   Strike: 140
                 Knockout: 1
    AdjustedForwardSpread: 145.7273
             ExerciseDate: 20-Jun-2012
                      CDS: [1x1 fininstrument.CDS]
                     Name: ""

CDSPutOption = fininstrument("cdsoption", 'Strike', OptionStrike, ...
    'ExerciseDate', OptionMaturity, 'OptionType', 'put', 'CDS', CDS, ...
    'Knockout',true, 'AdjustedForwardSpread', AdjustedForwardSpread)
CDSPutOption = 
  CDSOption with properties:

               OptionType: "put"
                   Strike: 140
                 Knockout: 1
    AdjustedForwardSpread: 145.7273
             ExerciseDate: 20-Jun-2012
                      CDS: [1x1 fininstrument.CDS]
                     Name: ""

Create CDSBlack Model Object

Use finmodel to create a CDSBlack model object.

CDSOptionModel = finmodel("cdsblack",'SpreadVolatility',SpreadVolatility)
CDSOptionModel = 
  CDSBlack with properties:

    SpreadVolatility: 0.6900

Create CDSBlack Pricer Object

Use finpricer to create a CDSBlack pricer object and use the ratecurve object for the zero curve for the 'DiscountCurve' name-value pair argument.

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

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

Price CDS Index Options

Use price to compute the price for the CDS index options.

outPrice = price(CDSOptionpricer, [CDSCallOption;CDSPutOption]);
fprintf('    Payer: %.0f   Receiver: %.0f  \n',outPrice(1),outPrice(2));
    Payer: 92   Receiver: 66  

Version History

Introduced in R2020a