other-calendars {bizdays}R Documentation

Calendars from other packages

Description

The packages RQuantLib and timeDate (Rmetrics) have functions to compute business days between 2 dates according to a predefined calendar. bizdays creates calendars based on these functions.

Usage

load_quantlib_calendars(ql_calendars = NULL, from, to, financial = TRUE)

load_rmetrics_calendars(year, financial = TRUE)

Arguments

ql_calendars

(QuantLib only) A character vector with the names of QuantLib's calendars. This parameter defaults to NULL, which loads all calendars.

from

(QuantLib only) the start date

to

(QuantLib only) the end date

financial

is a logical argument that defaults to TRUE.

year

(timeDate Rmetrics only) a vector with years to create the calendars.

Details

To load QuantLib's calendars use load_quantlib_calendars defining which calendar has to be loaded by its name and the range of dates the calendar has to handle. All QuantLib calendars have the QuantLib prefix.

To load Rmetrics' calendars use load_rmetrics_calendars defining the years the calendar has to handle. All Rmetrics calendars have the Rmetrics prefix.

Financial calendars

This argument defines the calendar as a financial or a non financial calendar. Financial calendars don't consider the ending business day when counting working days in bizdays. In QuantLib, Financial calendars are those that includeLast is set to FALSE.

List of calendars

QuantLib Calendars:

Rmetrics Calendars:

Examples

if (require("RQuantLib")) {
  # loading Argentina calendar
  load_quantlib_calendars("Argentina",
    from = "2016-01-01",
    to = "2016-12-31"
  )
  bizdays("2016-01-01", "2016-03-14", "QuantLib/Argentina")
  # loading 2 calendars
  load_quantlib_calendars(c("UnitedStates/NYSE", "UnitedKingdom/Settlement"),
    from = "2016-01-01", to = "2016-12-31"
  )
  bizdays("2016-01-01", "2016-03-14", "QuantLib/UnitedStates/NYSE")
  # loading all QuantLib's 50 calendars
  load_quantlib_calendars(from = "2016-01-01", to = "2016-12-31")
  bizdays("2016-01-01", "2016-03-14", "QuantLib/Brazil")
}

if (require("timeDate")) {
  # loading all Rmetrics calendar
  load_rmetrics_calendars(2016)
  bizdays("2016-01-01", "2016-03-14", "Rmetrics/NERC")
  bizdays("2016-01-01", "2016-03-14", "Rmetrics/NYSE")
}

[Package bizdays version 1.0.16 Index]