Learn R Programming

bizdays (version 0.1.4)

bizdays: Tools for business days calculations

Description

In many countries the standard approach to price derivatives and fixed income instruments involves the use of business days. In Brazil, for example, the great majoroty of financial insturments are priced on business days counting rules. Given that the use of business days is somehow vital to handle some tasks. That's the reason why bizdays came up, to make this task easier. It assumes only a list of dates representing the holidays, no hardcode and no magic rules for holiday guessing.

This function computes the amount of business days between 2 taking into account the holidays passed to the Calendar function.

Usage

bizdays(from, to, cal)

## S3 method for class 'character': bizdays(from, to, cal = bizdays.options$get("default.calendar"))

## S3 method for class 'POSIXct': bizdays(from, to, cal = bizdays.options$get("default.calendar"))

## S3 method for class 'POSIXlt': bizdays(from, to, cal = bizdays.options$get("default.calendar"))

## S3 method for class 'Date': bizdays(from, to, cal = bizdays.options$get("default.calendar"))

Arguments

from
the initial date (or a vector of dates)
to
the final date (or a vector of dates).
cal
an instance of Calendar

Examples

Run this code
data(holidaysANBIMA)
cal <- Calendar(holidaysANBIMA)
bizdays("2013-01-02", "2013-01-31", cal)
# Once you have a default calendar set
bizdays.options$set(default.calendar=cal)
bizdays("2013-01-02", "2013-01-31")

Run the code above in your browser using DataLab