diff options
Diffstat (limited to 'R/yieldcurve.R')
| -rw-r--r-- | R/yieldcurve.R | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/R/yieldcurve.R b/R/yieldcurve.R index 94762c25..b0703096 100644 --- a/R/yieldcurve.R +++ b/R/yieldcurve.R @@ -6,7 +6,7 @@ if(.Platform$OS.type == "unix"){ data.dir <- "//WDSENTINEL/share/CorpCDOs/data"
}
-getMarkitIRData <- function(date=Sys.Date(), currency="USD") {
+getMarkitIRData <- function(date=Sys.Date(), currency=c("USD", "EUR")) {
## downloads the latest available interest rates data from Markit
## before date and returns the parsed file into a list
require(xml2)
@@ -19,7 +19,7 @@ getMarkitIRData <- function(date=Sys.Date(), currency="USD") { return( as_list(read_xml(file.path(data.dir, "Yield Curves", filename.ext))) )
}else{
temp <- tempfile(tmpdir = file.path(data.dir, "Yield Curves"))
- download.file(paste("http://www.markit.com/news/", filename, ".zip", sep=""), temp, quiet=T)
+ download.file(paste0("http://www.markit.com/news/", filename, ".zip"), temp, quiet=T)
con <- file(temp, "r")
firstline <- readLines(con, 1, warn=FALSE)
## Markit returns a plain text file if there is no data.
@@ -51,7 +51,7 @@ nextthirdwed <- function(x) { thirdwed(y + 30 * (y < x))
}
-buildMarkitYC <- function(MarkitData, currency="USD", futurequotes){
+buildMarkitYC <- function(MarkitData, currency=c("USD", "EUR"), futurequotes){
deposits <- list()
futures <- list()
swaps <- list()
@@ -90,7 +90,7 @@ buildMarkitYC <- function(MarkitData, currency="USD", futurequotes){ return( tsQuotes )
}
-exportYC <- function(tradedate=Sys.Date(), currency="USD", useFutures=FALSE){
+exportYC <- function(tradedate=Sys.Date(), currency=c("USD", "EUR"), useFutures=FALSE){
## export the Yield Curve into the environment
require(RQuantLib)
if(useFutures){
@@ -113,7 +113,7 @@ exportYC <- function(tradedate=Sys.Date(), currency="USD", useFutures=FALSE){ USD = list(fixFreq="Semiannual",
floatFreq="Quarterly",
dayCounter="Thirty360"),
- EUR = list(fixfreq="Annual",
+ EUR = list(fixFreq="Annual",
floatFreq="Semiannual",
dayCounter="Thirty360"))
params <- list(tradeDate=tradedate,
|
