diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/load_cf.R | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/R/load_cf.R b/R/load_cf.R index 8d806bb8..85f0b8b0 100644 --- a/R/load_cf.R +++ b/R/load_cf.R @@ -225,11 +225,10 @@ getcusipcf <- function(params, cfdata, dist, tradedate=Sys.Date()){ }
compute.delta <- function(indexdist, dealweight, cusip.pv, tradedate=Sys.Date(), K1=0, K2=1){
- calibration.date <- addBusDay(tradedate)
+ calibration.date <- addBusDay(tradedate, -1)
## we assume the index is fully funded - need to be changed depending
## on how we fund the swaps (hence floating coupon instead of fixed)
- cs <- couponSchedule(IMMDate(tradedate), index$maturity, "Q",
- "FLOAT", 0.05, 0, calibration.date)
+ cs <- couponSchedule(IMMDate(calibration.date), index$maturity, "Q", "FLOAT", 0.05, 0)
nT <- dim(indexdist$L)[2]
Ngrid <- dim(indexdist$L)[1]
scenariosl <- matrix(0, length(dealweight), nT)
@@ -238,7 +237,6 @@ compute.delta <- function(indexdist, dealweight, cusip.pv, tradedate=Sys.Date(), scenariosl[,t] <- interpvalues(indexdist$L[,t], seq(0, 1, length=Ngrid), dealweight)
scenariosr[,t] <- interpvalues(indexdist$R[,t], seq(0, 1, length=Ngrid), dealweight)
}
-
indexpv <- c()
for(i in 1:length(dealweight)){
indexpv <- c(indexpv, funded.tranche.pv(scenariosl[i,], scenariosr[i,], cs, K1, K2, TRUE))
|
