bizdays
was developed to count business days between two
dates. This is a big issue in brazilian financial market because many
financial instruments consider the amount of business days in their
accounting rules. So, a typical use of the package is:
## [1] 18
The bizdays
function returns the amount of business days
between these dates according to the calendar
Brazil/ANBIMA
.
The calendar Brazil/ANBIMA
is already loaded and all
loaded calendars can be seen with calendars()
## Calendars:
## Actual, Brazil/ANBIMA, Brazil/B3, Brazil/BMF, EveryMonday, MyCalendar, WeekendsOnly, actual, example1, example2, example3, weekends
That lists calendars registered in the calendar register. Once you have a calendar registered you can simply use its name in the functions.
## [1] 27
You can look specificaly at one calendar by doing
## Brazil/B3 financial calendar
## 560 holidays
## 2 weekdays (saturday, sunday)
## range from 1990-01-01 to 2024-12-31
## bizdays arguments adjust
## from: following
## to: preceding
Calendars can be loaded from packages RQuantlib and timeDate (Rmetrics).
## Calendar Rmetrics/LONDON loaded
## Calendar Rmetrics/NERC loaded
## Calendar Rmetrics/NYSE loaded
## Calendar Rmetrics/TSX loaded
## Calendar Rmetrics/ZURICH loaded
## Calendars:
## Actual, Brazil/ANBIMA, Brazil/B3, Brazil/BMF, EveryMonday, MyCalendar, Rmetrics/LONDON, Rmetrics/NERC, Rmetrics/NYSE, Rmetrics/TSX, Rmetrics/ZURICH, WeekendsOnly, actual, example1, example2, example3, weekends
Once you have calendars loaded they can be directly used by its name.
## [1] 18
So, unless you really need a new calendar, you don’t have to create them.
## [1] 18
## [1] 21
## [1] "2022-02-01" "2022-02-07"
## [1] "2022-02-01" "2022-02-04"
## [1] "2022-02-01" "2022-02-02" "2022-02-03" "2022-02-04"
## [1] "2022-02-01" "2022-02-02" "2022-02-03" "2022-02-04" "2022-02-07"
## [6] "2022-02-08"