diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/calibrate_tranches_BC.R | 10 | ||||
| -rw-r--r-- | R/calibration.R | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/R/calibrate_tranches_BC.R b/R/calibrate_tranches_BC.R index f9cc6262..1796007e 100644 --- a/R/calibrate_tranches_BC.R +++ b/R/calibrate_tranches_BC.R @@ -61,7 +61,8 @@ for(i in seq_along(runs$name)){ ig19 = as.Date("2013-05-01"),
ig21 = as.Date("2013-09-26"),
ig23 = as.Date("2014-10-14"),
- hy23 = as.Date("2014-10-16"))
+ hy23 = as.Date("2014-10-16"),
+ xo22 = as.Date("2014-10-20"))
}
if(begin.date > as.Date(args$until)){
next
@@ -72,7 +73,12 @@ for(i in seq_along(runs$name)){ for(j in seq_along(bus.dates)){
tradedate <- bus.dates[j]
loginfo(paste("calibrating", index.name, tenor, "for", as.character(tradedate)))
- exportYC(tradedate)
+ if(substr(index.name,1,2) %in% c("xo", "eu")){
+ curr <- "EUR"
+ }else{
+ curr <- "USD"
+ }
+ exportYC(tradedate, curr)
index <- creditIndex(index.name, tenor)
index <- set.index.desc(index, tradedate)
## calibrate the single names curves
diff --git a/R/calibration.R b/R/calibration.R index 2f5877ee..571201da 100644 --- a/R/calibration.R +++ b/R/calibration.R @@ -88,9 +88,14 @@ set.tranchedata <- function(index, tradedate){ index$K.orig <- K index$K <- adjust.attachments(K, index$loss, index$factor) + ## convert snac prices to proper upfront + if(substr(index$name,1, 2) %in% c("xo")){ + temp$trancheupfrontmid[4] <- 100*(1-snacpv(index$cs, temp$trancherunningmid[4]*1e-4, 0.05, 0.4, tradedate)) + temp$trancherunningmid[4] <- 500 + } ## compute dirty protection price accrued <- cdsAccrued(tradedate, temp$trancherunningmid*1e-4) - if(length(grep("hy", index$name, ignore.case=TRUE))>0){ + if(substr(index$name, 1, 2) %in% c("hy")){ dirtyquotes <- 1 - temp$trancheupfrontmid/100 - accrued }else{ dirtyquotes <- temp$trancheupfrontmid/100 - accrued |
