Main Content

CDS

CDSinstrument object

Description

Create and price aCDSinstrument object for one or more CDS instruments using this workflow:

  1. Usefininstrumentto create aCDSinstrument object for one or more CDS instruments.

  2. Usedefprobcurveto specify a default probability curve for theCDSinstrument object.

  3. Usefinpricerto specify aCreditpricing method for one or moreCDSinstruments.

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

For more information on the available models and pricing methods for aCDSinstrument, seeChoose Instruments, Models, and Pricers.

Creation

Description

example

CDSobj= fininstrument(InstrumentType,'Maturity',maturity_date,'ContractSpread',contractspread_value)creates aCDSobject for one or more CDS instruments by specifyingInstrumentTypeand sets thepropertiesfor the required name-value pair argumentsMaturityandContractSpread.

example

CDSobj= fininstrument(___,Name,Value)sets optionalpropertiesusing 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 aCDSinstrument 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 of"CDS", a character vector with the value of'CDS', anNINST-by-1string array with values of"CDS", or anNINST-by-1cell array of character vectors with values of'CDS'.

Data Types:char|cell|string

CDSName-Value Pair Arguments

Specify required and optional comma-separated pairs ofName,Valuearguments.Nameis the argument name andValueis the corresponding value.Namemust appear inside quotes. You can specify several name and value pair arguments in any order asName1,Value1,...,NameN,ValueN.

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

expand all

Maturity date, specified as the comma-separated pair consisting of'Maturity'and a scalar datetime, serial date number, date character vector, date string or anNINST-by-1vector of datetimes, serial date numbers, cell array of date character vectors, or date string array.

If you use date characters vector or date strings, the format must be recognizable bydatetimebecause theMaturityproperty is stored as a datetime.

Data Types:char|cell|double|string|datetime

Contract spreads expressed in basis points, specified as the comma-separated pair consisting of'ContractSpread'and a scalar numeric or anNINST-by-1数字矢量tor.

Data Types:double

OptionalCDSName-Value Pair Argument

expand all

Premium payments per year, specified as the comma-separated pair consisting of'Period'and a scalar numeric or anNINST-by-1数字矢量tor with values of1,2,3,4,6, or12.

Data Types:double

Day count basis, specified as the comma-separated pair consisting of'Basis'and a scalar positive integer or anNINST-by-1vector of positive integers using 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, seeBasis.

Data Types:double

Business day conventions for cash flow dates, specified as the comma-separated pair consisting of'BusDayConvention'and a scalar string or character vector or anNINST-by-1cell array of character vectors or string array. 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|cell|string

为应计费用, specified as the comma-separated pair consisting of'PayAccruedPremium'and a scalar Boolean flag or anNINST-by-1vector of Boolean flags that aretrueif accrued premiums are paid upon default andfalseotherwise.

Data Types:logical

Recovery rate, specified as the comma-separated pair consisting of'RecoveryRate'and a scalar decimal or anNINST-by-1vector of decimals from0to1.

Data Types:double

Contract notional value, specified as the comma-separated pair consisting of'Notional'and a scalar positive integer or anNINST-by-1vector of positive integers.

Data Types:double

Holidays used in computing business days, specified as the comma-separated pair consisting of'Holidays'and dates using anNINST-by-1vector of 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 one of more instruments, specified as the comma-separated pair consisting of'Name'and a scalar string or character vector or anNINST-by-1cell array of character vectors or string array.

Data Types:char|cell|string

Properties

expand all

Maturity date, returned as a scalar datetime or anNINST-by-1vector of datetimes.

Data Types:datetime

Contract spreads expressed in basis points, returned as a scalar numeric or anNINST-by-1数字矢量tor.

Data Types:double

Premium payments per year, returned as a scalar numeric or anNINST-by-1数字矢量tor.

Data Types:double

Day count basis, returned as a scalar positive integer or anNINST-by-1vector of positive integers.

Data Types:double

Business day conventions for cash flow dates, returned as a scalar string or anNINST-by-1string array.

Data Types:string

为应计费用, returned as a scalar Boolean flag or anNINST-by-1vector of Boolean flags.

Data Types:logical

Recovery rate, returned as a scalar decimal or anNINST-by-1vector of decimals.

Data Types:double

Contract notional value, returned as a scalar positive integer or anNINST-by-1vector of positive integers.

Data Types:double

Holidays used in computing business days, returned as anNINST-by-1vector of datetimes.

Data Types:datetime

User-defined name for the instrument, returned as a string or anNINST-by-1string array.

Data Types:string

Examples

collapse all

This example shows the workflow to price aCDSinstrument when you use adefprobcurvemodel and aCreditpricing method.

CreateCDSInstrument Object

Usefininstrumentto create aCDSinstrument 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"

CreatedefprobcurveObject

Create adefprobcurveobject usingdefprobcurve.

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]

CreateratecurveObject

Create aratecurveobject usingratecurve.

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"

CreateCreditPricer Object

Usefinpricerto create aCreditpricer object and use theratecurveobject 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]

PriceCDSInstrument

Usepriceto compute the price for theCDSinstrument.

Price = price(outPricer,CDS)
Price = 52.7426

This example shows the workflow to price multipleCDS当你使用工具defprobcurvemodel and aCreditpricing method.

CreateCDSInstrument Object

Usefininstrumentto create aCDSinstrument object for three CDS instruments.

CDS = fininstrument("CDS",'Maturity',datetime([2021,9,15 ; 2021,10,15 ; 2021,11,15]),'ContractSpread',15,'Notional',[20000 ; 30000 ; 40000],'Period',4,'Basis',3,'BusinessDayConvention',"follow",'Name',"CDS_instrument")
CDS=3×1 object3x1 CDS array with properties: ContractSpread Maturity Period Basis RecoveryRate BusinessDayConvention Holidays PayAccruedPremium Notional Name

CreatedefprobcurveObject

Create adefprobcurveobject usingdefprobcurve.

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]

CreateratecurveObject

Create aratecurveobject usingratecurve.

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"

CreateCreditPricer Object

Usefinpricerto create aCreditpricer object and use theratecurveobject 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]

PriceCDSInstruments

Usepriceto compute the prices for theCDSinstruments.

Price = price(outPricer,CDS)
Price =3×152.7426 80.2945 108.0357
Introduced in R2020a