diff options
| -rw-r--r-- | R/calibrate_tranches.R | 4 | ||||
| -rw-r--r-- | R/cds_utils.R | 8 | ||||
| -rw-r--r-- | R/yieldcurve.R | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/R/calibrate_tranches.R b/R/calibrate_tranches.R index 178f23ae..f71ec719 100644 --- a/R/calibrate_tranches.R +++ b/R/calibrate_tranches.R @@ -59,14 +59,14 @@ for(i in 1:nrow(nondefaulted)){ }
issuerweights <- rep(1/length(hy19portfolio), length(hy19portfolio))
-hy19$indexref <- 0.99
+hy19$indexref <- 1.0125
hy19portfolio.tweaked <- tweakcurves(hy19portfolio, hy19)
SurvProb <- SPmatrix(hy19portfolio.tweaked, hy19)
## load common parameters
K <- c(0, 0.15, 0.25, 0.35, 1)
Kmodified <- adjust.attachments(K, hy19$loss, hy19$factor)
-tranche.upf <- c(37.8125, 87.375, 102.125, 114.96875)
+tranche.upf <- c(40.625, 94.15, 105.6525, 116)
tranche.running <- c(0.05, 0.05, 0.05, 0.05)
Ngrid <- 2*nrow(nondefaulted)+1
diff --git a/R/cds_utils.R b/R/cds_utils.R index afb8f400..9017e655 100644 --- a/R/cds_utils.R +++ b/R/cds_utils.R @@ -87,8 +87,12 @@ couponSchedule <- function(nextpaydate=NULL, maturity, frequency, coupontype, cu }else{
dates <- seq(nextpaydate, maturity, by = bystring)
}
- if(dates[length(dates)]<maturity){
- dates <- c(dates, maturity)
+ if(length(dates)==0){
+ dates <- maturity
+ }else{
+ if(dates[length(dates)]<maturity){
+ dates <- c(dates, maturity)
+ }
}
dates <- dates[ dates >= today()]
DC <- switch(frequency,
diff --git a/R/yieldcurve.R b/R/yieldcurve.R index 42b5ae3f..691386a2 100644 --- a/R/yieldcurve.R +++ b/R/yieldcurve.R @@ -1,6 +1,3 @@ -library(XML)
-root.dir = file.path("//WDSENTINEL/share/CorpCDOs/")
-
getMarkitIRData <- function(date=Sys.Date()) {
## downloads the latest available interest rates data from Markit
## before date and returns the parsed file into a list
@@ -28,7 +25,7 @@ getMarkitIRData <- function(date=Sys.Date()) { ## we unzip it
unzip(temp, exdir = file.path(root.dir, "/data/Yield Curves"))
unlink(temp)
- break
+ return( xmlToList(file.path(root.dir, "data/Yield Curves", filename.ext)) )
}
}
}
|
