add_dates: Return CDS dates.

View source: R/add_dates.R

add_datesR Documentation

Return CDS dates.

Description

add_dates takes a data frame which contains dates, tenor (or maturity) and currency and returns appropriate dates for pricing a CDS contract.

Usage

add_dates(
  x,
  date.var = "date",
  maturity.var = "maturity",
  tenor.var = "tenor",
  currency.var = "currency"
)

Arguments

x

a data frame, containing all necessary information

date.var

character, column name of date variable

maturity.var

character, column name of maturity variable

tenor.var

character, column name of tenor variable

currency.var

character, column name of currency variable

Value

a date frame containing all the input columns, as well as eight more columns: stepinDate (T+1), valueDate (T+3 business days), startDate (accrual begin date), endDate (maturity), backstopDate (T-60 day look back from which 'protection' is effective), firstcouponDate (the date on which the first coupon is paid), pencouponDate (second to last coupon date), and baseDate (the starting date for the IR curve)

References

https://www.cdsmodel.com/cdsmodel/assets/cds-model/docs/c-code%20Key%20Functions-v1.pdf https://www.cdsmodel.com/assets/cds-model/docs/Standard%20CDS%20Examples.pdf

Examples

x <- data.frame(date = c(as.Date("2014-05-06"), as.Date("2014-05-07")),
                tenor = rep(5, 2), currency = c("JPY", "USD"))
add_dates(x)

creditr documentation built on April 3, 2025, 5:53 p.m.