cdsprice
Determine price for credit default swap
Syntax
[Price, AccPrem, PaymentDates, PaymentTimes,
PaymentCF]
= cdsprice(ZeroData, ProbData, Settle,
Maturity, ContractSpread)
[Price, AccPrem, PaymentDates, PaymentTimes,
PaymentCF]
= cdsprice(ZeroData, ProbData,
Settle, Maturity, ContractSpread,
Name,Value)
Description
[Price, AccPrem, PaymentDates, PaymentTimes,
PaymentCF]
= cdsprice(ZeroData, ProbData, Settle,
Maturity, ContractSpread) computes
the price, or the marktomarket value for CDS instruments.
[Price, AccPrem, PaymentDates, PaymentTimes,
PaymentCF]
= cdsprice(ZeroData, ProbData,
Settle, Maturity, ContractSpread,
Name,Value) computes the
price, or the marktomarket value for CDS instruments with additional
options specified by one or more Name,Value pair
arguments.
ZeroData 
Mby2 vector of dates
and zero rates or an IRDataCurve object of zero
rates. 
ProbData 
Pby2 array of dates
and default probabilities. 
Settle 
Settlement date is a serial date number or date string. This
must be earlier than or equal to the Maturity dates.

Maturity 
Nby1 vector of serial
date numbers or date strings containing the maturity dates.

ContractSpread 
Nby1 vector of contract
spreads, expressed in basis points.

NameValue Pair Arguments
Specify optional commaseparated pairs of Name,Value arguments.
Name is the argument
name and Value is the corresponding
value. Name must appear
inside single quotes (' ').
You can specify several name and value pair
arguments in any order as Name1,Value1,...,NameN,ValueN.
Note:
Any optional input of size Nby1 is also
acceptable as an array of size 1byN,
or as a single value applicable to all contracts. Single values are
internally expanded to an array of size Nby1. 
'Basis' 
Nby1 vector of daycount
basis of the CDS:
For more information, see basis.
Default: 2 (actual/360) 
'BusDayConvention' 
String or Nby1 cell
array of strings of business day conventions. Values are: actual follow modifiedfollow previous modifiedprevious
Default: actual 
'Notional' 
Nby1 vector of contract
notional values. Use positive values for long positions and negative
values for short positions. Default: 10MM 
'PayAccruedPremium' 
Nby1 vector of Boolean
flags. True, if accrued premiums are paid upon
default, False otherwise.
Default: True 
'Period' 
Nby1 vector of number
of premiums per year of the CDS. Allowed values are 1, 2, 3, 4, 6,
and 12. Default: 4 
'RecoveryRate' 
Nby1 vector of recovery
rates, expressed as a decimal from 0 to 1.
Default: 0.4 
'TimeStep' 
Positive integer indicating the number of days to take as time
step for the numerical integration.
Default: 10 (days) 
'ZeroBasis' 
Basis of the zero curve, where the choices are identical to Basis.
Default: 0 (actual/actual) 
'ZeroCompounding' 
Compounding frequency of the zero curve. Allowed values are: 1 — Annual compounding 2 — Semiannual compounding 3 — Compounding three times per year 4 — Quarterly compounding 6 — Bimonthly compounding 12 — Monthly compounding 1 — Continuous compounding
Note:
When ZeroData is an IRDataCurve object,
the arguments ZeroCompounding and ZeroBasis are
implicit in ZeroData and are redundant inside this
function. In that case, specify these optional arguments when constructing
the IRDataCurve object before calling this function. 
Default: 2 (Semiannual compounding) 
Output Arguments
Price 
Nby1 vector of CDS clean
prices. 
AccPrem 
Nby1 vector of accrued
premiums. 
PaymentDates 
NbynumCF matrix of payment
dates. 
PaymentTimes 
NbynumCF matrix of accrual
fractions. 
PaymentCF 
NbynumCF matrix of payments.

Examples
expand all
This example shows how to use cdsprice to compute the clean price for a CDS contract using the following data.
Settle = '17Jul2009'; % valuation date for the CDS
Zero_Time = [.5 1 2 3 4 5]';
Zero_Rate = [1.35 1.43 1.9 2.47 2.936 3.311]'/100;
Zero_Dates = daysadd(Settle,360*Zero_Time,1);
ZeroData = [Zero_Dates Zero_Rate];
ProbData = [daysadd(datenum(Settle),360,1), 0.0247];
Maturity = '20Sep2010';
ContractSpread = 135;
[Price,AccPrem] = cdsprice(ZeroData,ProbData,Settle,Maturity,ContractSpread)
Price =
1.5461e+04
AccPrem =
10500
More About
expand all
The price or marktomarket (MtM) value of an existing CDS contract
is computed using the following formula:
CDS price = Notional * (Current Spread  Contract Spread)
* RPV01
Current Spread is the current breakeven spread
for a similar contract, according to current market conditions. RPV01 is
the 'risky present value of a basis point,' the present value of the
premium payments, taking into consideration the default probability.
This formula assumes a long position, and the right side is multiplied
by 1 for short positions.
The premium leg is computed as the product of a spread S and
the risky present value of a basis point (RPV01).
The RPV01 is given by:
when no accrued premiums are paid upon default, and it can be
approximated by
when accrued premiums are paid upon default. Here, t_{0} = 0 is
the valuation date, and t_{1},...,t_{n} = T are
the premium payment dates over the life of the contract,T is
the maturity of the contract, Z(t) is the discount
factor for a payment received at time t, and Δ(t_{j1},
t_{j}, B) is a day count between dates t_{j1} and t_{j} corresponding
to a basis B.
The protection leg of a CDS contract is given by the following
formula:
where the integral is approximated with a finite sum over the
discretization τ_{0} = 0,τ_{1},...,τ_{M} = T.
If the spread of an existing CDS contract is S_{C},
and the current breakeven spread for a comparable contract is S_{0},
the current price, or marktomarket value of the contract is given
by:
MtM = Notional (S_{0} –S_{C} )RPV01
This assumes a long position from the protection standpoint
(protection was bought). For short positions, the sign is reversed.
References
Beumee, J., D. Brigo, D. Schiemert, and G. Stoyle. "Charting
a Course Through the CDS Big Bang," Fitch Solutions,
Quantitative Research, Global Special Report. April 7,
2009.
Hull, J., and A. White, "Valuing Credit Default Swaps
I: No Counterparty Default Risk," Journal of Derivatives 8,
2940.
O'Kane, D. and S. Turnbull, "Valuation of Credit Default
Swaps." Lehman Brothers, Fixed Income Quantitative
Credit Research, April, 2003.
See Also
@IRDataCurve  cdsbootstrap  cdsoptprice  cdsspread