aboutsummaryrefslogtreecommitdiffstats
path: root/R/cds_functions_generic.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/cds_functions_generic.R')
-rw-r--r--R/cds_functions_generic.R4
1 files changed, 2 insertions, 2 deletions
diff --git a/R/cds_functions_generic.R b/R/cds_functions_generic.R
index 9bfccb86..1076ce7e 100644
--- a/R/cds_functions_generic.R
+++ b/R/cds_functions_generic.R
@@ -857,7 +857,7 @@ forward.prot <- function(index, exerciseDate){
defaultAdjustedForwardIndexPrice <- function(index, exerciseDate, fixedRate=0.05){
tes <- addBusDay(exerciseDate)
- df <- discountFactors(YC, tes)
+ df <- YC$discount(tes)
price <- 1 - FEP(index, exerciseDate) +
1/df * (forward.cl(index, exerciseDate) * fixedRate -
forward.prot(index, exerciseDate) - cdsAccrued(exerciseDate, fixedRate))
@@ -867,7 +867,7 @@ defaultAdjustedForwardIndexPrice <- function(index, exerciseDate, fixedRate=0.05
forwardflatcds <- function(h, cs, tradeDate, exerciseDate, fixedRate=0.05, R=0.4){
tes <- addBusDay(exerciseDate)
fep <- (1-R)*(1-exp(-h*yearFrac(tradeDate, exerciseDate)))
- df <- discountFactors(YC, tes)
+ df <- YC$discount(tes)
sc <- new("flatcurve", h=h)
cl <- couponleg(cs, sc, startdate=exerciseDate)
pl <- defaultleg(cs, sc, recovery=R, startdate=exerciseDate)