aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/build_portfolios.R1
-rw-r--r--R/build_scenarios.R5
-rw-r--r--R/intex_deal_functions.R3
-rw-r--r--R/script_calibrate_tranches.R4
4 files changed, 9 insertions, 4 deletions
diff --git a/R/build_portfolios.R b/R/build_portfolios.R
index e3e4fe4d..a365e8e4 100644
--- a/R/build_portfolios.R
+++ b/R/build_portfolios.R
@@ -12,6 +12,7 @@ if(.Platform$OS.type == "unix"){
source(file.path(root.dir, "code", "R", "intex_deal_functions.R"))
source(file.path(root.dir, "code", "R", "cds_utils.R"))
source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
+source(file.path(root.dir, "code", "R", "yieldcurve.R"))
hy21 <- load.index("hy21")
if(length(args) >=2){
diff --git a/R/build_scenarios.R b/R/build_scenarios.R
index 1e5b4ee1..c8d98e12 100644
--- a/R/build_scenarios.R
+++ b/R/build_scenarios.R
@@ -1,5 +1,7 @@
library(doParallel)
library(yaml)
+library(lossdistrib)
+
hostname <- system("hostname", intern=TRUE)
if(hostname=="debian"){
registerDoParallel(8)
@@ -24,7 +26,7 @@ if(length(args) >= 1){
if(length(args) >=2){
argslist <- strsplit(args[-1], ",")
dealnames <- unlist(lapply(argslist, function(x)x[1]))
- reinvflags <- as.logical(unlist(lapply(argslist, function(x)x[2])))
+ reinvflags <- as.logical(as.numeric(unlist(lapply(argslist, function(x)x[2]))))
}else{
data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
colClasses=c("character", "logical"))
@@ -37,6 +39,7 @@ source(file.path(root.dir, "code", "R", "intex_deal_functions.R"))
source(file.path(root.dir, "code", "R", "etdb.R"))
source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
source(file.path(root.dir, "code", "R", "cds_utils.R"))
+source(file.path(root.dir, "code", "R", "yieldcurve.R"))
load.index("hy21")
calibration.date <- addBusDay(tradedate, -1)
diff --git a/R/intex_deal_functions.R b/R/intex_deal_functions.R
index 6d1172d6..6f37efea 100644
--- a/R/intex_deal_functions.R
+++ b/R/intex_deal_functions.R
@@ -3,6 +3,7 @@ library(statmod)
library(data.table)
options(datatable.nomatch=0)
library(doParallel)
+library(lossdistrib)
hostname <- system("hostname", intern=TRUE)
if(hostname=="debian"){
@@ -17,10 +18,8 @@ if(.Platform$OS.type == "unix"){
root.dir <- "//WDSENTINEL/share/CorpCDOs/"
}
-source(file.path(root.dir, "code", "R", "yieldCurve.R"))
source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
source(file.path(root.dir, "code", "R", "etdb.R"))
-source(file.path(root.dir, "code", "R", "tranche_functions.R"))
getdealdata <- function(dealname, workdate){
sqlstring <- paste0("select marketvalue from et_deal_model_numbers where dealname='%s' and ",
diff --git a/R/script_calibrate_tranches.R b/R/script_calibrate_tranches.R
index 63cf4986..57181102 100644
--- a/R/script_calibrate_tranches.R
+++ b/R/script_calibrate_tranches.R
@@ -1,5 +1,8 @@
#!/usr/bin/Rscript
require(methods)
+library(lossdistrib)
+library(statmod)
+
options(warn=2)
args <- commandArgs(trailingOnly=TRUE)
@@ -11,7 +14,6 @@ if(.Platform$OS.type == "unix"){
source(file.path(root.dir, "code", "R", "cds_utils.R"))
source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
-source(file.path(root.dir, "code", "R", "tranche_functions.R"))
source(file.path(root.dir, "code", "R", "yieldcurve.R"))
source(file.path(root.dir, "code", "R", "optimization.R"))
load.index("hy21")