diff options
Diffstat (limited to 'R/tranche_functions.R')
| -rw-r--r-- | R/tranche_functions.R | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R index 39fd0b4d..ea3c2e32 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -712,7 +712,8 @@ BClossdistC <- function(defaultprob, issuerweights, recov, rho, Z, w, return(list(L=r$L,R=r$R))
}
-BCtranche.pv <- function(portfolio, index, coupon, K1, K2, rho1, rho2, N=length(portfolio)+1){
+BCtranche.pv <- function(portfolio, index, coupon, K1, K2, rho1, rho2, N=length(portfolio)+1,
+ tradedate=Sys.Date()){
## computes the protection leg, couponleg, and bond price of a tranche
## in the base correlation setting
if(K1==0){
@@ -720,8 +721,8 @@ BCtranche.pv <- function(portfolio, index, coupon, K1, K2, rho1, rho2, N=length( stop("equity tranche must have 0 lower correlation")
}
}
- SurvProb <- SPmatrix(portfolio, index)
- cs <- couponSchedule(IMMDate(Sys.Date()), index$maturity, "Q", "FIXED", coupon, 0)
+ cs <- couponSchedule(IMMDate(tradedate), index$maturity, "Q", "FIXED", coupon, 0, tradedate)
+ SurvProb <- SPmatrix(portfolio, length(cs$dates))
recov <- sapply(portfolio, attr, "recovery")
issuerweights <- rep(1/length(portfolio), length(portfolio))
K <- adjust.attachments(c(K1,K2), index$loss, index$factor)
|
