diff options
| -rw-r--r-- | R/build_scenarios.R | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/R/build_scenarios.R b/R/build_scenarios.R index 00fd9d9e..9225d094 100644 --- a/R/build_scenarios.R +++ b/R/build_scenarios.R @@ -13,12 +13,13 @@ if(length(args) >= 1){ }
if(length(args) >=2){
- dealnames <- args[2:length(args)]
- reinvflags <- rep(TRUE, length(dealnames))
+ dealnames <- args[-1]
+ reinvflags <- rep_len(TRUE, length(dealnames))
}else{
- data <- read.table(file.path(root.dir, "scripts", "scenarios.txt"))
- dealnames <- as.character(data$V1)
- reinvflags <- as.logical(data$V2)
+ data <- read.table(file.path(root.dir, "scripts", "scenarios.txt"),
+ colClasses=c("character", "logical"))
+ dealnames <- data$V1
+ reinvflags <- data$V2
unlink(file.path(root.dir, "scripts", "scenarios.txt"))
}
@@ -219,6 +220,8 @@ for(j in seq_along(dealnames)){ }else{
coupon <- reinvfixed
}
+ #reinvest tweak
+ coupon <- coupon-0.0075
for(i in seq_along(deal.datesmonthly)){
reinvprices[[assetname]][i] <-
100 * forwardportfolioprice(deal.portfolio, deal.datesmonthly[i],
|
