summaryrefslogtreecommitdiffstats
path: root/R/tranche_functions.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/tranche_functions.R')
-rw-r--r--R/tranche_functions.R10
1 files changed, 9 insertions, 1 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 16960e0..8d7958d 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -740,11 +740,19 @@ BCtranche.delta <- function(index, tradedate = Sys.Date()){
deltas <- (bp[,2]-bp[,3])/(indexbp[2]-indexbp[3])
deltasplus <- (bp[,4]-bp[,1])/(indexbp[4]-indexbp[1])
- gammas <- (deltasplus-deltas)/(indexbp[1]-indexbp[1])/100
+ gammas <- (deltasplus-deltas)/(indexbp[2]-indexbp[1])/100
return( list(deltas=deltas, gammas=gammas) )
}
+BCtranche.corr01 <- function(index, eps=0.01){
+ ##does a parallel shift of the skew and computes the change in pv
+ before <- BCtranche.pv(index)
+ index$rho[-1] <- index$rho[-1]+eps
+ after <- BCtranche.pv(index)
+ return(before$bp-after$bp)
+}
+
EL <- function(index, discounted=TRUE, shortened=0){
## computes the expected loss of a portfolio (time discounted if discounted is TRUE)
## given the default curves and recovery