aboutsummaryrefslogtreecommitdiffstats
path: root/R/build_scenarios.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/build_scenarios.R')
-rw-r--r--R/build_scenarios.R17
1 files changed, 10 insertions, 7 deletions
diff --git a/R/build_scenarios.R b/R/build_scenarios.R
index 6e007341..92364c17 100644
--- a/R/build_scenarios.R
+++ b/R/build_scenarios.R
@@ -216,11 +216,13 @@ for(j in seq_along(dealnames)){
}else{
rollingmaturity <- basecase.rollingmaturity
}
- DC <- DiscountCurve(L3m$params, L3m$tsQuotes, yearFrac(L3m$params$tradeDate, deal.datesmonthlylagged))
- df <- DC$discounts
- forwards <- DC$forwards
-
+ ## DC <- DiscountCurve(L3m$params, L3m$tsQuotes, yearFrac(L3m$params$tradeDate, deal.datesmonthlylagged))
+ ## df <- DC$discounts
+ ## forwards <- DC$forwards
+ cdrmonthly.dt <- data.table(date=deal.datesmonthly, t(cdrmonthly), key="date")
+ recoverymonthly.dt <- data.table(date=deal.datesmonthly, t(recoverymonthly), key="date")
reinvassets <- get.reinvassets(dealnames[j], workdate)
+
reinvprices <- list()
if(reinvflags[j] && length(reinvassets)>0){
for(assetname in names(reinvassets)){
@@ -234,12 +236,13 @@ for(j in seq_along(dealnames)){
coupon <- coupon-0.01
reinvprices[[assetname]] <- foreach(date = iter(deal.datesmonthly), .combine=c) %dopar% {
- 100 * forwardportfolioprice(deal.portfolio, date,
- min(date+rollingmaturity*30, deal.data$maturity),
- asset$coupontype, coupon, asset$liborfloor/100)
+ 100 * forwardportfolioprice2(cdrmonthly.dt, recoverymonthly.dt, date,
+ min(date+rollingmaturity*30, deal.data$maturity),
+ asset$coupontype, coupon, asset$liborfloor/100)
}
}
}
+
## reinvprices <- compute.reinvprices(df, forwards, cdrmonthly, recoverymonthly, reinvspread,
## reinvfixed, rollingmaturity, reinvlag)