From 7d402dd37f2b735dcca547412feb534ea1336efe Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Tue, 5 Aug 2014 15:31:43 -0400 Subject: also returns future deltas --- R/tranche_functions.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/tranche_functions.R b/R/tranche_functions.R index cf3df0f..fb8a4fa 100644 --- a/R/tranche_functions.R +++ b/R/tranche_functions.R @@ -701,14 +701,16 @@ theta.adjust.skew <- function(index, shortened=4){ return(c(0, rhofun(K), NA)) } -BCtranche.theta <- function(index, shortened=4){ +BCtranche.theta <- function(index, tradedate=Sys.Date(), shortened=4){ temp <- BCtranche.pv(index) index$rho <- theta.adjust.skew(index, shortened) N <- nrow(index$cs)-shortened index$cs <- index$cs[1:N,] index$defaultprob <- index$defaultprob[,1:N] temp2 <- BCtranche.pv(index) - return(temp2$bp-temp$bp+index$tranche.running) + temp3 <- BCtranche.delta(index, tradedate) + return(list(theta=temp2$bp-temp$bp+index$tranche.running, + delta=temp3$delta)) } BCtranche.delta <- function(index, tradedate = Sys.Date()){ -- cgit v1.2.3-70-g09d2