diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/calibrate_tranches_BC.R | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R index 7b863e40..342daef7 100644 --- a/R/calibrate_tranches_BC.R +++ b/R/calibrate_tranches_BC.R @@ -63,11 +63,9 @@ source(file.path(root.dir, "code", "R", "yieldcurve.R")) source(file.path(root.dir, "code", "R", "optimization.R"))
source(file.path(root.dir, "code", "R", "calibration.R"), chdir=TRUE)
source(file.path(root.dir, "code", "R", "serenitasdb.R"))
+source(file.path(root.dir, "code", "R", "creditIndex.R"))
library(lossdistrib)
-n.int <- 250
-list2env(GHquad(n.int), envir=parent.frame())
-Ngrid <- 201
for(i in seq_along(runs$name)){
index.name <- runs$name[i]
tenor <- runs$tenor[i]
@@ -103,8 +101,7 @@ for(i in seq_along(runs$name)){ quotes <- matrix(0, length(bus.dates), 2+2*n.tranches)
for(j in seq_along(bus.dates)){
tradedate <- bus.dates[j]
- index <- load.index(index.name, tradedate, tenor, Z, w, Ngrid)
- temp <- get.tranchequotes(index$name, index$tenor, tradedate)
+ temp <- get.tranchequotes(index.name, tenor, tradedate)
quotes[j, 1] <- temp$indexrefprice[1]
quotes[j, 2] <- temp$indexrefspread[1]
quotes[j, 2+1:n.tranches] <- temp$trancheupfrontmid
@@ -132,7 +129,8 @@ for(i in seq_along(runs$name)){ tradedate <- bus.dates[i]
cat("calibrating", index.name, tenor, "for", as.character(tradedate), "\n", sep=" ")
exportYC(tradedate)
- index <- load.index(index.name, tradedate, tenor, Z, w, Ngrid)
+ index <- creditIndex(index.name, tenor)
+ index <- set.index.desc(index, tradedate)
## calibrate the single names curves
index <- set.singlenamesdata(index, tradedate)
index <- set.tranchedata(index, tradedate)
|
