summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-05 15:31:43 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2014-08-05 15:31:43 -0400
commit7d402dd37f2b735dcca547412feb534ea1336efe (patch)
treec1012506122fa9388f526f8e611732892eb9d760
parenta2e904751abc48ca76745a0905586ab56f5325ca (diff)
downloadlossdistrib-7d402dd37f2b735dcca547412feb534ea1336efe.tar.gz
also returns future deltas
-rw-r--r--R/tranche_functions.R6
1 files 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()){