other-calendars: Calendars from other packages

other-calendarsR 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:

  • QuantLib/TARGET

  • QuantLib/Argentina

  • QuantLib/Australia

  • QuantLib/Brazil

  • QuantLib/Canada

  • QuantLib/Canada/Settlement

  • QuantLib/Canada/TSX

  • QuantLib/China

  • QuantLib/CzechRepublic

  • QuantLib/Denmark

  • QuantLib/Finland

  • QuantLib/Germany

  • QuantLib/Germany/FrankfurtStockExchange

  • QuantLib/Germany/Settlement

  • QuantLib/Germany/Xetra

  • QuantLib/Germany/Eurex

  • QuantLib/HongKong

  • QuantLib/Hungary

  • QuantLib/Iceland

  • QuantLib/India

  • QuantLib/Indonesia

  • QuantLib/Italy

  • QuantLib/Italy/Settlement

  • QuantLib/Italy/Exchange

  • QuantLib/Japan

  • QuantLib/Mexico

  • QuantLib/NewZealand

  • QuantLib/Norway

  • QuantLib/Poland

  • QuantLib/Russia

  • QuantLib/SaudiArabia

  • QuantLib/Singapore

  • QuantLib/Slovakia

  • QuantLib/SouthAfrica

  • QuantLib/SouthKorea

  • QuantLib/SouthKorea/KRX

  • QuantLib/Sweden

  • QuantLib/Switzerland

  • QuantLib/Taiwan

  • QuantLib/Turkey

  • QuantLib/Ukraine

  • QuantLib/UnitedKingdom

  • QuantLib/UnitedKingdom/Settlement

  • QuantLib/UnitedKingdom/Exchange

  • QuantLib/UnitedKingdom/Metals

  • QuantLib/UnitedStates

  • QuantLib/UnitedStates/Settlement

  • QuantLib/UnitedStates/NYSE

  • QuantLib/UnitedStates/GovernmentBond

  • QuantLib/UnitedStates/NERC

Rmetrics Calendars:

  • Calendar Rmetrics/LONDON

  • Calendar Rmetrics/NERC

  • Calendar Rmetrics/NYSE

  • Calendar Rmetrics/TSX

  • Calendar Rmetrics/ZURICH

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")
}

bizdays documentation built on May 29, 2024, 11:56 a.m.