diff options
Diffstat (limited to 'R/intex_deal_functions.R')
| -rw-r--r-- | R/intex_deal_functions.R | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/R/intex_deal_functions.R b/R/intex_deal_functions.R index 1717a336..53f12c77 100644 --- a/R/intex_deal_functions.R +++ b/R/intex_deal_functions.R @@ -395,16 +395,15 @@ intexportfolio.forwardprice <- function(cdrmonthly, recoverymonthly, startdate, forwardcs <- if( missing(liborfloor) || is.na(liborfloor) ) { data.table(couponSchedule(nextpaydate=startdate+45, maturity, - frequency="Q", coupontype, margin, - 0., tradedate=startdate), + frequency="Q", coupontype, NA, + margin, tradedate=startdate), key="dates") } else { data.table(couponSchedule(nextpaydate=startdate+45, maturity, - frequency="Q", coupontype, margin, - NA, tradedate=startdate, liborfloor=liborfloor), + frequency="Q", coupontype, NA, + margin, tradedate=startdate, liborfloor=liborfloor), key="dates") } - notionals <- cdrmonthly[date>=startdate, lapply(.SD,function(x)cumprod(1-x/100*1/12)), .SDcols=paste0("V",1:100)] recovery <- as.matrix(recoverymonthly[date>=startdate, .SD, .SDcols=paste0("V",1:100)])* @@ -433,6 +432,15 @@ compute.reinvprices <- function(dealname, cdrmonthly, recoverymonthly, params, r for(assetname in names(reinvassets)){ asset <- reinvassets[[assetname]] coupon <- if(asset$coupontype=="FLOAT") params$reinvfloat else params$reinvfixed + ## reinvprices[[assetname]] <- c() + ## for(i in seq_along(cdrmonthly$date)) { + ## date <- cdrmonthly$date[i] + ## reinvprices[[assetname]] <- + ## c(reinvprices[[assetname]], + ## 100 * intexportfolio.forwardprice(cdrmonthly, recoverymonthly, date, + ## min(date+rollingmaturity, maturity), + ## asset$coupontype, coupon, asset$liborfloor/100)) + ## } reinvprices[[assetname]] <- foreach(date = iter(cdrmonthly$date), .combine=c) %dopar% { 100 * intexportfolio.forwardprice(cdrmonthly, recoverymonthly, date, min(date+rollingmaturity, maturity), |
