aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/calibrate_tranches_BC.R15
1 files changed, 8 insertions, 7 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R
index ef906575..70a3cce9 100644
--- a/R/calibrate_tranches_BC.R
+++ b/R/calibrate_tranches_BC.R
@@ -25,10 +25,10 @@ if(is.null(args$config)){
if(is.null(args$index)){
stop("Please provide an index name")
}
- runs <- list(name=args$index, tenor=args$tenor)
+ config <- list(runs=list(c(args$index, args$tenor)))
}else{
library(yaml)
- runs <- yaml.load_file(file.path(root.dir,"code", "etc", args$config))
+ config <- yaml.load_file(file.path(root.dir,"code", "etc", args$config))
}
options(stringsAsFactors = FALSE)
@@ -39,9 +39,9 @@ source(file.path(root.dir, "code", "R", "serenitasdb.R"))
source(file.path(root.dir, "code", "R", "creditIndex.R"))
source(file.path(root.dir, "code", "R", "tranche_functions.R"))
-for(i in seq_along(runs$name)){
- index.name <- runs$name[i]
- tenor <- runs$tenor[i]
+for(run in config$runs){
+ index.name <- run[1]
+ tenor <- run[2]
filename <- file.path(root.dir, "Tranche_data", "Runs",
paste(tolower(index.name), tenor, "csv",sep="."))
if(!file.exists(filename)){
@@ -65,7 +65,8 @@ for(i in seq_along(runs$name)){
xo22 = as.Date("2014-10-20"),
xo24 = as.Date("2015-09-28"),
eu9 = as.Date("2014-09-15"),
- eu21 = as.Date("2014-09-15"),
+ eu19 = as.Date("2013-04-03"),
+ eu21 = as.Date("2014-03-27"),
eu22 = as.Date("2014-10-22"),
eu24 = as.Date("2015-09-23"))
}
@@ -130,4 +131,4 @@ for(i in seq_along(runs$name)){
loginfo("done")
}
}
-dbDisconnect(serenitasdb)
+try(dbDisconnect(serenitasdb), TRUE)