aboutsummaryrefslogtreecommitdiffstats
path: root/R/intex_deal_functions.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/intex_deal_functions.R')
-rw-r--r--R/intex_deal_functions.R5
1 files changed, 4 insertions, 1 deletions
diff --git a/R/intex_deal_functions.R b/R/intex_deal_functions.R
index 6f37efea..524ca36e 100644
--- a/R/intex_deal_functions.R
+++ b/R/intex_deal_functions.R
@@ -209,7 +209,10 @@ buildSC <- function(line.item, reinvdate, dealmaturity, global.params, startdate
line.item$nextpaydate <- SC@startdate
## automatic reinvest
SC<- stackcurve(SC, line.item, global.params, SC@startdate)
+ }else{
+ SC <- NULL
}
+
}else if(line.item$maturity <= startdate){#matured asset
SC <- buildSC.matured(SC, line.item, reinvdate, dealmaturity, global.params, startdate)
if(is.na(line.item$price))line.item$price <- 100
@@ -233,7 +236,7 @@ buildSC <- function(line.item, reinvdate, dealmaturity, global.params, startdate
SC@curve <- try
}
}
- if(!is.na(reinvdate) && creditcurve.maturity(SC) <= reinvdate){
+ if(!is.na(reinvdate) && !is.null(SC) && creditcurve.maturity(SC) <= reinvdate){
## if reinvdate is missing, assume no reinvestment
## otherwise reinvest
newstartdate <- line.item$maturity