aboutsummaryrefslogtreecommitdiffstats
path: root/R/yieldcurve.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/yieldcurve.R')
-rw-r--r--R/yieldcurve.R15
1 files changed, 8 insertions, 7 deletions
diff --git a/R/yieldcurve.R b/R/yieldcurve.R
index 1841c123..c745fb3c 100644
--- a/R/yieldcurve.R
+++ b/R/yieldcurve.R
@@ -1,11 +1,12 @@
require(RQuantLib)
-
-if(.Platform$OS.type == "unix"){
- data.dir <- "/home/share/CorpCDOs/data"
+root.dir <- if(.Platform$OS.type == "unix"){
+ "/home/share/CorpCDOs"
}else{
- data.dir <- "//WDSENTINEL/share/CorpCDOs/data"
+ "//WDSENTINEL/share/CorpCDOs"
}
+source(file.path(root.dir, "code", "R", "db.R"))
+
getMarkitIRData <- function(date=Sys.Date(), currency=c("USD", "EUR")) {
## returns Markit rates from serenitasdb
currency <- match.arg(currency)
@@ -73,9 +74,9 @@ exportYC <- function(tradedate=Sys.Date(), currency=c("USD", "EUR"), useFutures
}
}
MarkitData <- getMarkitIRData(tradedate, currency)
- evaldate <- as.Date(tradedate)
setEvaluationDate(tradedate)
- sDate <- advance(calendar="WeekendsOnly", tradedate, 2, 0)
+ ## sDate <- advance(calendar="WeekendsOnly", tradedate, 2, 0)
+ sDate <- tradedate
setCalendarContext(calendar="WeekendsOnly", fixingDays=2,
settleDate=sDate)
legparams <- switch(currency,
@@ -94,5 +95,5 @@ exportYC <- function(tradedate=Sys.Date(), currency=c("USD", "EUR"), useFutures
}else{
quotes <- buildMarkitYC(MarkitData, currency)
}
- YC <<- list(params=params, tsQuotes=quotes, legparams=legparams)
+ YC <<- DiscountCurve(YC$params, YC$tsQuotes, YC$legparams)
}