From 2643a2d4adeb9a4dcfcbc34ec742085f4f2a8746 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Mon, 14 Jul 2014 16:04:31 -0400 Subject: add new corr01 risk function --- R/tranche_functions.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'R/tranche_functions.R') 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 -- cgit v1.2.3-70-g09d2