aboutsummaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/calibration.R19
1 files changed, 13 insertions, 6 deletions
diff --git a/R/calibration.R b/R/calibration.R
index ea3c6d14..762c3a53 100644
--- a/R/calibration.R
+++ b/R/calibration.R
@@ -30,13 +30,19 @@ set.singlenamesdata <- function(index, tradedate){
tenor <- names(cds.cs$cdsdates)
index$portfolio <- list()
for(i in seq_along(quotes$tickers)){
- sane.quotes <- which(yearFrac(tradedate+2,cds.cs$cdsdates)*quotes$spread_curve[i, tenor]*1e-4+
- quotes$upfront_curve[i, tenor] * 0.01>0)
+ if(quotes$ticker[i] %in% c("IACI", "TITANC")){
+ quotes$spread_curve[i,] <- rep(0.001,8)
+ quotes$upfront_curve[i,] <- rep(0,8)
+ quotes$recovery[i,] <- rep(0.4,8)
+ }
+ quotes$upfront_curve[i, tenor] <- pmax(-yearFrac(tradedate+2,cds.cs$cdsdates)*
+ quotes$spread_curve[i, tenor]*1e-2,
+ quotes$upfront_curve[i, tenor])
quote <- list(ticker = quotes$ticker[i],
- running = quotes$spread_curve[i, tenor[sane.quotes]] * 1e-4,
- upfront = quotes$upfront_curve[i, tenor[sane.quotes]] * 0.01,
- recovery = as.double(quotes$recovery[i,tenor[sane.quotes]][1]))
- index$portfolio <- c(index$portfolio, buildSC(quote, cds.cs$cs, cds.cs$cdsdates[sane.quotes]))
+ running = quotes$spread_curve[i, tenor] * 1e-4,
+ upfront = quotes$upfront_curve[i, tenor] * 0.01,
+ recovery = as.double(quotes$recovery[i,tenor][1]))
+ index$portfolio <- c(index$portfolio, buildSC(quote, cds.cs$cs, cds.cs$cdsdates))
}
index$issuerweights <- rep(1/length(index$portfolio), length(index$portfolio))
index$recov <- sapply(index$portfolio, attr, "recovery")
@@ -68,6 +74,7 @@ set.tranchedata <- function(index, tradedate){
stop(paste(index$portfolio[[negprob[1,1]]]@issuer, "has negative probability, check single names data"))
}
K <- c(0, temp$detach/100)
+ index$K.orig <- K
index$K <- adjust.attachments(K, index$loss, index$factor)
index$tranche.upf <- temp$trancheupfront
index$tranche.running <- temp$trancherunning*1e-4