aboutsummaryrefslogtreecommitdiffstats
path: root/R/calibration.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/calibration.R')
-rw-r--r--R/calibration.R8
1 files changed, 3 insertions, 5 deletions
diff --git a/R/calibration.R b/R/calibration.R
index 809edf1a..083174fa 100644
--- a/R/calibration.R
+++ b/R/calibration.R
@@ -11,14 +11,11 @@ buildSC <- function(quote, cs, cdsdates){
return( SC )
}
-get.cdsSchedule <- function(tradedate, indexmaturity){
+get.cdsSchedule <- function(tradedate){
cdsdates <- as.Date(character(0))
- for(tenor in paste0(c(1:5, 7,10), "y")){
+ for(tenor in paste0(c(1:5, 7), "y")){
newdate <- cdsMaturity(tenor, date=tradedate)
cdsdates <- c(cdsdates, newdate)
- if(newdate>=indexmaturity){
- break
- }
}
return( list(cs=couponSchedule(IMMDate(tradedate, noadj=TRUE), cdsdates[length(cdsdates)], "Q", "FIXED",
1, tradedate, IMMDate(tradedate, "prev")), cdsdates=cdsdates) )
@@ -35,6 +32,7 @@ set.singlenamesdata <- function(index, tradedate){
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])