aboutsummaryrefslogtreecommitdiffstats
path: root/R/load_cf.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/load_cf.R')
-rw-r--r--R/load_cf.R6
1 files changed, 3 insertions, 3 deletions
diff --git a/R/load_cf.R b/R/load_cf.R
index 7ae5846c..84b339f3 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -180,7 +180,7 @@ getdealcf <- function(dealnames, workdate=Sys.Date()){
## date in intex vector is pre current date.
## we also add some wiggle room at the end to make sure we're not missing one date
prevpaydate <- basic.advance(sqldata$"Deal Next Pay Date", -3, "month")
- alldates <- seq.Date(from=prevpaydate, sqldata$maturity+5, by="1 month")
+ alldates <- seq.Date(from=prevpaydate, sqldata$maturity+7, by="1 month")
T <- ifelse(alldates>=L3m$params$tradeDate, yearFrac(L3m$params$tradeDate, alldates), 0)
DC <- DiscountCurve(L3m$params, L3m$tsQuotes, T)
@@ -301,7 +301,7 @@ getcusipcf <- function(cusips, cfdata, dist, workdate=Sys.Date()){
return(cusipdata)
}
-compute.delta <- function(indexdist, dealweight, cusip.pv, workdate=Sys.Date()){
+compute.delta <- function(indexdist, dealweight, cusip.pv, workdate=Sys.Date(), K1=0, K2=1){
calibration.date <- prevBusDay(workdate)
## we assume the index is fully funded - need to be changed depending
## on how we fund the swaps (hence floating coupon instead of fixed)
@@ -318,7 +318,7 @@ compute.delta <- function(indexdist, dealweight, cusip.pv, workdate=Sys.Date()){
indexpv <- c()
for(i in 1:length(dealweight)){
- indexpv <- c(indexpv, funded.tranche.pv(scenariosl[i,], scenariosr[i,], cs, 0, 1))
+ indexpv <- c(indexpv, funded.tranche.pv(scenariosl[i,], scenariosr[i,], cs, K1, K2, TRUE))
}
model <- lm(cusip.pv~indexpv, weights=dealweight)