aboutsummaryrefslogtreecommitdiffstats
path: root/R/thetas-durations.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/thetas-durations.R')
-rw-r--r--R/thetas-durations.R8
1 files changed, 4 insertions, 4 deletions
diff --git a/R/thetas-durations.R b/R/thetas-durations.R
index d5f150f5..bb57cfad 100644
--- a/R/thetas-durations.R
+++ b/R/thetas-durations.R
@@ -60,7 +60,7 @@ fastduration <- function(sc, cs, tradedate, maturities){
return( r )
}
-fasttheta <- function(sc, cs, recov, tradedate, maturities, quotes){
+fasttheta <- function(sc, cs, recov, tradedate, maturities, quotes, fixedrate=0.05){
r <- rep(NA, length(maturities))
if(is.null(sc)){
return(r)
@@ -76,8 +76,8 @@ fasttheta <- function(sc, cs, recov, tradedate, maturities, quotes){
}else{
newcs <- cs[cs$unadj.dates<=newmaturities[i],]
upfront <- defaultleg(newcs, sc, recov, startdate) -
- (couponleg(newcs, sc, startdate, accruedondefault=TRUE)-acc)*0.05
- r[i] <- quotes[i]-upfront+0.05
+ (couponleg(newcs, sc, startdate, accruedondefault=TRUE)-acc)*fixedrate
+ r[i] <- quotes[i]-upfront+fixedrate
}
}
return( r )
@@ -91,7 +91,7 @@ sqlstr.duration <- paste("UPDATE index_quotes set duration=$1 where date=$2 and
sqlstr.theta <- paste("UPDATE index_quotes set theta=$1 where date=$2 and index=$3",
"and series=$4 and tenor=$5")
-for(series in c(16, 17, 18, 19, 20, 21, 22, 23)){
+for(series in c(16, 17, 18, 19, 20, 21, 22, 23, 24)){
indexquotes <- get.indexquotes(index, series)
indexquotes <- indexquotes[!(is.na(indexquotes[,"3yr"]) & is.na(indexquotes[,"5yr"])
& is.na(indexquotes[,"7yr"])),]