aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/cds_utils.R4
-rw-r--r--R/yieldcurve.R4
2 files changed, 5 insertions, 3 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R
index ccf7ef52..640981ca 100644
--- a/R/cds_utils.R
+++ b/R/cds_utils.R
@@ -43,7 +43,7 @@ couponSchedule <- function(nextpaydate=NULL, maturity,
## maturity: last payment date of the schedule
## frequency: letter specifying the frequency between "Q", "M", "B", "S" or "A"
## if startdate is provided, we generate the forward coupon schedule starting from that date.
- frequency <- match.arg("frequency")
+ frequency <- match.arg(frequency)
bystring <- switch(frequency,
Quarterly = "3 months",
Monthly = "1 month",
@@ -170,7 +170,7 @@ cdsMaturity <- function(tenor, date=Sys.Date()){
}
yearFrac <- function(date1, date2, daycount=c("act/365", "act/360")) {
- daycount <- match.arch(daycount)
+ daycount <- match.arg(daycount)
switch(daycount,
"act/365"=as.numeric( (as.Date(date2) - as.Date(date1)) / 365),
"act/360"=as.numeric( (as.Date(date2) - as.Date(date1)) / 360) )
diff --git a/R/yieldcurve.R b/R/yieldcurve.R
index b0703096..f592c8c8 100644
--- a/R/yieldcurve.R
+++ b/R/yieldcurve.R
@@ -11,6 +11,7 @@ getMarkitIRData <- function(date=Sys.Date(), currency=c("USD", "EUR")) {
## before date and returns the parsed file into a list
require(xml2)
i <- 0
+ currency <- match.arg(currency)
while( TRUE ) {
lastdate <- format(date-i, "%Y%m%d")
filename <- paste("InterestRates", currency, lastdate, sep="_")
@@ -37,7 +38,6 @@ getMarkitIRData <- function(date=Sys.Date(), currency=c("USD", "EUR")) {
}
}
}
- return( as_list(read_xml(paste(filename,".xml", sep=""))) )
}
thirdwed <- function(x) {
@@ -52,6 +52,7 @@ nextthirdwed <- function(x) {
}
buildMarkitYC <- function(MarkitData, currency=c("USD", "EUR"), futurequotes){
+ currency <- match.arg(currency)
deposits <- list()
futures <- list()
swaps <- list()
@@ -92,6 +93,7 @@ buildMarkitYC <- function(MarkitData, currency=c("USD", "EUR"), futurequotes){
exportYC <- function(tradedate=Sys.Date(), currency=c("USD", "EUR"), useFutures=FALSE){
## export the Yield Curve into the environment
+ currency <- match.arg(currency)
require(RQuantLib)
if(useFutures){
futurefile <- file.path(data.dir, "Yield Curves",