aboutsummaryrefslogtreecommitdiffstats
path: root/R/calibrate_tranches_BC.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/calibrate_tranches_BC.R')
-rw-r--r--R/calibrate_tranches_BC.R10
1 files changed, 4 insertions, 6 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R
index f4bb3668..38294f0f 100644
--- a/R/calibrate_tranches_BC.R
+++ b/R/calibrate_tranches_BC.R
@@ -47,9 +47,8 @@ for(i in seq_along(runs$name)){
if(!file.exists(filename)){
args$update <- FALSE
}
- if(args$update){##ghetto way of getting the last row of the file
- runfile <- read.csv(filename)
- begin.date <- as.Date(runfile[nrow(runfile),1])+1
+ if(args$update){
+ begin.date <- getlastdate(index.name, tenor)
}else{
begin.date <- switch(index.name,
hy10 = as.Date("2014-08-11"),
@@ -119,9 +118,8 @@ for(i in seq_along(runs$name)){
cat(csvheaders(index), sep="\n", file=filename)
}
cat(tocsv(index), sep="\n", file=filename, append=TRUE)
+ dbSendQuery(serenitasdb, tosql(index))
loginfo("done")
}
}
-## it's really ghetto, but that works for now...
-cmd <- paste("python3" , file.path(root.dir, "code", "python", "populate_risk_numbers.py"))
-system(cmd)
+dbDisconnect(serenitasdb)