Spread, upfront, and default probability.
Exposure measurements.
Real time data and other supportive layers.
Wednesday, May 27, 2015
Access to creditr from GitHub
## not run
library(devtools)
install_github("yuanchu/creditr")
library(creditr)
S4 design: CDS class
library(creditr)
x <- CDS(date = as.Date("2014-05-07"),
tenor = 5,
spread = 50,
coupon = 100)
slotNames(x)
## [1] "name" "contract" "RED" "date" "spread" ## [6] "maturity" "tenor" "coupon" "recovery" "currency" ## [11] "notional" "principal" "accrual" "pd" "price" ## [16] "upfront" "spread.DV01" "IR.DV01" "rec.risk.01"
Spread, upfront, and default probability.
Exposure measurements.
Real time data and other supportive layers.
\(spread.to.upfront\)
spread.to.upfront(data.frame(date = Sys.Date(),
spread = 160,
tenor = 5,
recovery = 0.4,
coupon = 100,
currency = "USD"))
## [1] 259021
\(upfront.to.spread\)
upfront.to.spread(data.frame(date = Sys.Date(),
upfront = 1000000,
tenor = 5,
recovery = 0.4,
coupon = 100,
currency = "USD"))
## [1] 335.7157
\(spread.to.pd\)
spread.to.pd(data.frame(date = Sys.Date(),
spread = 160,
tenor = 5,
recovery = 0.4,
currency = "USD"))
## [1] 0.1279975
\(pd.to.spread\)
pd.to.spread(data.frame(date = Sys.Date(),
pd = 0.1,
tenor = 5,
recovery = 0.4,
currency = "USD"))
## [1] 123.0821
\(spread.DV01\)
# calculates the change in upfront value when the spread rises
# by 1 basis point.
x <- data.frame(date = as.Date(c("2014-04-22", "2014-04-22")),
currency = c("USD", "EUR"),
tenor = c(5, 5),
spread = c(120, 110),
coupon = c(100, 100),
recovery = c(0.4, 0.4),
notional = c(1e7, 1e7))
spread.DV01(x)
## [1] 4768.084 4878.017
\(CS10\)
# calculates the change in upfront value when the spread rises 10% CS10(x)
## [1] 56952.65 53430.42
\(IR.DV01\)
# calculate the change in upfront when there is a 1 basis point # increase in interest rate IR.DV01(x)
## [1] -25.15333 -12.85976
\(rec.risk.01\)
# calculates the amount of change in upfront when there is a 1% # increase in recovery rate rec.risk.01(x)
## [1] -82.18602 -38.82727
Dates and conventions.
Yield curves download from Markit and FRED
am new to R?
just want a result from a beautiful interface?
want a play toy when reading a introduction paper of CDS?
Yuanchu Dang
Zijie Zhu