diff options
| -rw-r--r-- | R/calibration.R | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/R/calibration.R b/R/calibration.R index 469fe9db..a7c07100 100644 --- a/R/calibration.R +++ b/R/calibration.R @@ -53,8 +53,12 @@ set.tranchedata <- function(index, tradedate){ K <- c(0, 0.15, 0.25, 0.35, 1) index$K <- adjust.attachments(K, index$loss, index$factor) index$tranche.upf <- index$tranche.data$Mid - index$tranche.running <- index$tranche.data$Coupon - ##convert the quotes + if("Coupon" %in% names(index$tranche.data)){ + index$tranche.running <- index$tranche.data$Coupon + }else{ + index$tranche.running <- rep(0.05, nrow(index$tranche.data)) + } + ## convert the quotes ## - we convert to protection terms x->1-x/100 ## - we remove accrued x->x-acc ## - we weight it by the size of the tranche |
