aboutsummaryrefslogtreecommitdiffstats
path: root/R/calibration.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/calibration.R')
-rw-r--r--R/calibration.R7
1 files changed, 6 insertions, 1 deletions
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