Main Content

Credit

Create Credit pricer object for CDS instrument using defprobcurve

Since R2020a

Description

Create and price a CDS instrument object with a defprobcurve and a Credit pricing method using this workflow:

  1. Create a default probability curve object using defprobcurve.

  2. Use finpricer to specify a Credit pricer object for the CDS 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 CDS instrument, see Choose Instruments, Models, and Pricers.

Creation

Description

CreditPricerObj = finpricer(PricerType,'DiscountCurve',ratecurve_obj,'DefaultProbabilityCurve',defprobcurve_object) creates a Credit pricer object by specifying PricerType and the required name-value pair arguments DiscountCurve and DefaultProbabilityCurve to set properties using name-value pairs. For example, CreditPricerObj = finpricer("Credit",'DiscountCurve',ratecurve_obj,'DefaultProbabilityCurve',defprobcurve_obj) creates a Credit pricer object.

example

Input Arguments

expand all

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

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: CreditPricerObj = finpricer("Credit",'DiscountCurve',ratecurve_obj,'DefaultProbabilityCurve',defprobcurve_obj)

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

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

Data Types: object

Properties

expand all

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

Data Types: object

Default probability curve, returned as a defprobcurve object.

Data Types: object

Object Functions

priceCompute price for credit derivative instrument with Credit pricer

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(2027,9,20),'ContractSpread', 50,'Name',"CDS_instrument")
CDS = 
  CDS with properties:

           ContractSpread: 50
                 Maturity: 20-Sep-2027
                   Period: 4
                    Basis: 2
             RecoveryRate: 0.4000
    BusinessDayConvention: "actual"
                 Holidays: NaT
        PayAccruedPremium: 1
                 Notional: 10000000
                     Name: "CDS_instrument"

Create defprobcurve Object

Create a defprobcurve object using defprobcurve.

Settle = datetime(2017, 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)
DefaultProbCurve = 
  defprobcurve with properties:

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

Create ratecurve Object

Create a ratecurve object using ratecurve.

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 Credit Pricer Object

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

CDSpricer = finpricer("credit",'DiscountCurve',ZeroCurve,'DefaultProbabilityCurve',DefaultProbCurve)
CDSpricer = 
  Credit with properties:

              DiscountCurve: [1x1 ratecurve]
                   TimeStep: 10
    DefaultProbabilityCurve: [1x1 defprobcurve]

Price CDS Instrument

Use price to compute the price for the CDS instrument.

outPrice = price(CDSpricer, CDS)
outPrice = 
6.9363e+04

Version History

Introduced in R2020a