cds
Syntax
cds(settlement, maturity, evalDate, notional, spread, riskFree, recovery,
isSeller, frequency, calendar, [convention='Following'],
[termDateConvention='Following'], [rule='CDS'], [basis=1])
Details
Value a Credit Default Swap (CDS) contract.
Return value: A DOUBLE scalar or vector.
Arguments
settlement is a DATE scalar or vector indicating the settlement date of the CDS contract.
maturity is a DATE scalar or vector indicating the maturity date of the CDS contract. Note that settlement should be earlier than maturity of the same contract.
evalDate is a DATE scalar or vector indicating the evaluation date of the CDS contract. Note that evalDate should be no later than settlement.
notional is a non-negative numeric scalar or vector indicating the notional principal of the CDS contract.
spread is a numeric scalar or vector indicating the CDS spread. The CDS spread is the amount the buyer pays to the seller each period, which is quoted as a percentage of the contract’s notional principal in basis points (bps).
riskFree is a non-negative numeric scalar or vector indicating the risk-free interest rate of the CDS contract.
recovery is a numeric scalar or vector in [0,1), indicating the recovery rate. It is the estimated percentage of par value that the bondholder will receive after a credit event (e.g., default).
isSeller is an INT scalar or vector indicating whether the party is the buyer or the seller. 1 for the seller and 0 for the buyer.
frequency defines how often payments are made in the swap agreement.
- If it is an INT scalar or vector, it specifies the number of payments per year. For example, 1 means there's one payment annually.
- If it is a DURATION scalar or vector, it specifies time interval between payments. For example, "3M" means payments occur every 3 months (quarterly).
- It can take the following values:
- 1 / 1y: Annually. One payment per year.
- 2 / 6M: Semi-annually. Two payments per year, every 6 months.
- 3 / 4M: Triannually. Three payments per year, every 4 months
- 4 / 3M: Quarterly. Four payments per year, every 3 months.
- 6 / 2M: Bimonthly. Six payments per year, every 2 months.
- 12 / 1M: Monthly. 12 payments per year, once a month.
- 13 / 4w: Four-weekly. 13 payments per year, every 4 weeks.
- 26 / 2w: Fortnightly. 26 payments per year, every 2 weeks.
- 52 / 1w: Weekly. 52 payments per year, once a week.
- 365 / 1d: Daily. 365 payments per year, once a day.
calendar is a STRING scalar or vector indicating the trading calendar(s). See Trading Calendar for more information.
convention (optional) is a STRING scalar or vector indicating how cash flows that fall on a non-trading day are treated. It can be:
- 'Following': The following trading day.
- 'ModifiedFollowing' (default): The following trading day. If that day is in a different month, the preceding trading day is adopted instead.
- 'Preceding': The preceding trading day.
- 'ModifiedPreceding': The preceding trading day. If that day is in a different month, the following trading day is adopted instead.
- 'Unadjusted': Unadjusted.
- 'HalfMonthModifiedFollowing': The following trading day. If that day crosses the mid-month (15th) or the end of month, the preceding trading day is adopted instead.
- 'Nearest': The nearest trading day. If both the preceding and following trading days are equally far away, default to following trading day.
termDateConvention (optional) is a STRING scalar or vector indicating how maturity date that falls on a non-trading day is treated. Parameter options and the default value are the same as convention.
rule (optional) is a STRING scalar or vector indicating how the list of dates is generated. It can be:
- 'Backward': Backward from maturity date to settlement date.
- 'Forward': Forward from settlement date to maturity date.
- 'Zero': No intermediate dates between settlement date and maturity date.
- 'ThirdWednesday': All dates but settlement date and maturity date are taken to be on the third Wednesday of their month (with forward calculation).
- 'ThirdWednesdayInclusive': All dates are taken to be on the third Wednesday of their month (with forward calculation).
- 'Twentieth': All dates but the settlement date are taken to be the twentieth of their month (used for CDS schedules in emerging markets). The maturity date is also modified.
- 'TwentiethIMM': All dates but the settlement date are taken to be the twentieth of an IMM (International Money Market) month(used for CDS schedules). The maturity date is also modified.
- 'OldCDS': Same as TwentiethIMM with unrestricted date ends and long/short stub coupon period (old CDS convention).
-
'CDS' (default): Credit derivatives standard rule defined in the "Big Bang" Protocol in 2009.
-
'CDS2015': Ammended credit derivatives standard rule that took effect on December 20, 2015.
basis (optional) is an INT scalar or vector indicating the day-count basis of the CDS contract. It can be:
- 0: US (NASD) 30/360
- 1 (default): actual/actual
- 2: actual/360
- 3: actual/365
- 4: European 30/360
Note: If some input parameters are scalars while others are vectors, scalars will be expanded to match the length of the vectors. All vectors must have the same length.
Examples
The following example values the specified CDS contract based on the input.
valDate = 2007.05.15
settlement = 2007.05.16
maturity = 2007.08.16
notional = 1000000.0
spread = 0.0150
riskFreeRate = 0.01
recoveryRate = 0.5
isSeller = true
frequency = 4
convention = 'Following'
termDateConvention = 'Unadjusted'
rule = 'TwentiethIMM'
basis = 3
cds(settlement, maturity, valDate, notional, spread, riskFreeRate, recoveryRate, isSeller, frequency, 'CCFX', convention, termDateConvention, rule, basis)
// Output: -5.448913728297157