aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/build_portfolios.R32
-rw-r--r--R/cds_functions_generic.R2
2 files changed, 18 insertions, 16 deletions
diff --git a/R/build_portfolios.R b/R/build_portfolios.R
index d81ae8f5..924a499c 100644
--- a/R/build_portfolios.R
+++ b/R/build_portfolios.R
@@ -15,21 +15,23 @@ source(file.path(code.dir, "code", "R", "yieldcurve.R"))
source(file.path(code.dir, "code", "R", "serenitasdb.R"), chdir=TRUE)
source(file.path(code.dir, "code", "R", "creditIndex.R"))
-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])))
-}else{
- data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
- colClasses=c("character", "logical"))
- dealnames <- data$V1
- reinvflags <- data$V2
-}
-
-if(length(args) >= 1){
- workdate <- as.Date(args[1])
-}else{
- workdate <- Sys.Date()
+if(interactive()) {
+ ## enter the parameters here
+ workdate <- as.Date("2016-02-17")
+ dealnames <- c("centur15")
+ reinvflags <- c(TRUE)
+} else {
+ 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])))
+ }else{
+ data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
+ colClasses=c("character", "logical"))
+ dealnames <- data$V1
+ reinvflags <- data$V2
+ }
+ workdate <- if(length(args) >=1) as.Date(args[1]) else Sys.Date()
}
calibration.date <- addBusDay(workdate, -1)
diff --git a/R/cds_functions_generic.R b/R/cds_functions_generic.R
index 6bba5091..96463a43 100644
--- a/R/cds_functions_generic.R
+++ b/R/cds_functions_generic.R
@@ -554,7 +554,7 @@ bondhazardrate.shaped <- function(collateral, shape, R=0.4, alpha=0.25, beta=15,
sc <- new("shapedcurve", h=0.05, shape=shape, alpha=alpha, beta=beta)
eps <- 1e-8
counter <- 0
- if(collateral$price<2){
+ if(collateral$price<3){
cat("price is too low\n")
sc <- new("shapedcurve", h=1e6, shape=shape, alpha=alpha, beta=beta)
return( shapedtodpc(cs, sc, startdate) )