Main Content

CDS

CDS instrument object

Description

Create and price a CDS instrument object using this workflow:

  1. Use fininstrument to create a CDS instrument object.

  2. Use defprobcurve to specify a default probability curve for the CDS instrument.

  3. Use finpricer to specify a Credit pricing method for the CDS instrument.

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 models and pricing methods for a CDS instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

example

CDSobj = fininstrument(InstrumentType,'Maturity',maturity_date,'ContractSpread',contractspread_value) creates a CDS object by specifying InstrumentType and sets the properties for the required name-value pair arguments Maturity and ContractSpread.

example

CDSobj = fininstrument(___,Name,Value) sets optional properties using additional name-value pairs in addition to the required arguments in the previous syntax. For example, CDSobj = fininstrument("CDS",'Maturity',datetime(2019,1,30),'ContractSpread',200,'Period',4,'Basis',5,'BusinessDayConvention','follow','Name',"cds_instrument") creates a CDS instrument with contract spread of 200. You can specify multiple name-value pair arguments.

Input Arguments

expand all

Instrument type, specified as a string with the value "CDS" or the character vector with the value 'CDS'.

Data Types: char | string

CDS Name-Value Pair Arguments

Specify required and optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: CDSobj = fininstrument("CDS",'Maturity',datetime(2019,1,30),'ContractSpread',200,'Period',4,'Basis',5,'BusinessDayConvention',"follow",'Name',"cds_instrument")
Required CDS Name-Value Pair Arguments

expand all

Maturity date, specified as the comma-separated pair consisting of 'Maturity' and a datetime, serial date number, date character vector, or date string.

If you use a date character vector or date string, the format must be recognizable by datetime because the Maturity property is stored as a datetime.

Data Types: char | double | string | datetime

Contract spreads expressed in basis points, specified as the comma-separated pair consisting of 'ContractSpread' and a scalar numeric.

Data Types: double

Optional CDS Name-Value Pair Argument

expand all

Premium payments per year, specified as the comma-separated pair consisting of 'Period' and a scalar numeric with values of 1, 2, 3, 4, 6, or 12.

Data Types: double

Day-count basis, specified as the comma-separated pair consisting of 'Basis' and a scalar positive integer using one of the following values:

  • 0 — actual/actual

  • 1 — 30/360 (SIA)

  • 2 — actual/360

  • 3 — actual/365

  • 4 — 30/360 (PSA)

  • 5 — 30/360 (ISDA)

  • 6 — 30/360 (European)

  • 7 — actual/365 (Japanese)

  • 8 — actual/actual (ICMA)

  • 9 — actual/360 (ICMA)

  • 10 — actual/365 (ICMA)

  • 11 — 30/360E (ICMA)

  • 12 — actual/365 (ISDA)

  • 13 — BUS/252

For more information, see Basis.

Data Types: double

Business day conventions for cash flow dates, specified as the comma-separated pair consisting of 'BusDayConvention' and a string or character vector. The selection for business day convention determines how nonbusiness days are treated. Nonbusiness days are defined as weekends plus any other date that businesses are not open (for example, statutory holidays). Values are:

  • "actual" — Nonbusiness days are effectively ignored. Cash flows that fall on nonbusiness days are assumed to be distributed on the actual date.

  • "follow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day.

  • "modifiedfollow" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the following business day. However if the following business day is in a different month, the previous business day is adopted instead.

  • "previous" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day.

  • "modifiedprevious" — Cash flows that fall on a nonbusiness day are assumed to be distributed on the previous business day. However if the previous business day is in a different month, the following business day is adopted instead.

Data Types: char | string

Flag for accrued premiums, specified as the comma-separated pair consisting of 'PayAccruedPremium' and a scalar Boolean flag that is true if accrued premiums are paid upon default, false otherwise.

Data Types: logical

Recovery rate, specified as the comma-separated pair consisting of 'RecoveryRate' and a scalar decimal from 0 to 1.

Data Types: double

Contract notional value, specified as the comma-separated pair consisting of 'Notional' and a scalar positive integer.

Data Types: double

Holidays used in computing business days, specified as the comma-separated pair consisting of 'Holidays' and dates using datetimes, serial date numbers, cell array of date character vectors, or date string array. For example:

H = holidays(datetime('today'),datetime(2025,12,15));
CDSobj = fininstrument("CDS",'Maturity',datetime(2025,12,15),'ContractSpread',200,'Holidays',H)

Data Types: double | cell | datetime | string

User-defined name for the instrument, specified as the comma-separated pair consisting of 'Name' and a scalar string or character vector.

Data Types: char | string

Properties

expand all

Maturity date, returned as a datetime.

Data Types: datetime

Contract spreads expressed in basis points, returned as a scalar numeric.

Data Types: double

Premium payments per year, returned as a scalar numeric.

Data Types: double

Day-count basis, returned as a scalar positive integer.

Data Types: double

Business day conventions for cash flow dates, returned as a string.

Data Types: string

Flag for accrued premiums, returned as a scalar Boolean flag.

Data Types: logical

Recovery rate, returned as a scalar decimal.

Data Types: double

Contract notional value, returned as a scalar positive integer.

Data Types: double

Holidays used in computing business days, returned as datetimes.

Data Types: datetime

User-defined name for the instrument, returned as a string.

Data Types: string

Examples

collapse all

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: [10x1 datetime]
    DefaultProbabilities: [10x1 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: [10x1 datetime]
                Rates: [10x1 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: [1x1 ratecurve]
                   TimeStep: 10
    DefaultProbabilityCurve: [1x1 defprobcurve]

Price CDS Instrument

Use price to compute the price for the CDS instrument.

Price = price(outPricer,CDS)
Price = 52.7426
Introduced in R2020a