Business Days Calculations and Utilities

Business days calculations based on a list of holidays and nonworking weekdays. Quite useful for fixed income and derivatives pricing.


Travis build status AppVeyor build status Downloads Coverage status

bizdays computes business days between dates based on collections of nonworking days and nonworking weekdays (usually weekends). It also helps with other issues related to business days calculations like check whether a date is a business day, offset a date by a number of business days, adjust dates for the next or previous business day, create generators of business days sequences, and much more. All functions are vectorizable so that speed up the calculations for large collections of dates.

Installing

It is available on CRAN to be installed through:

install.packages('bizdays')

or using devtools

devtools::install_github('R-bizdays', username='wilsonfreitas')

Holidays

I've included a dataset called holidaysANBIMA containing the list of holidays released by ANBIMA, this is quite useful at brazilian financial market. So, if you have a specific list of holidays used at any market in the world, please share with me, I will be glad to include it in future releases.

News

Changes in Verson 1.0.6

  • Import and export calendars (issue #25)

  • Implemented getdate function (issue #28)

  • Renamed functions (replaced dots with _) (issue #76)

Changes in Verson 1.0.5

  • Implemented bizdays optimisations (issue #70)

  • New vignette "Financial and non financial calendars"

  • Improved Calendar's print method, now it is more informative (issue #68)

  • Introduced the financial argument to create.calendar. It allows to create non financial calendars (issue #62)

  • Removed the old calendars construction: the Calendar function

Changes in Version 1.0.4

  • Implemented bizdiff function (issue #57).

  • Defined start and end dates for Rmetrics calendars (issue #60)

  • Implemented new Calendar methods: holidays and weekdays (issue #61)

Changes in Version 1.0.3

  • Implemented check in tests for suggested packages: RQuantLib and timeDate (issue #56).

Changes in Version 1.0.2

  • Implemented the double index strategy to avoid inconsistencies in business days counting (issue #54)

  • Added has.calendars function to check if a calendar exists

  • Implemented requireNamespace check for Suggedted packages: RQuantLib and timeDate

  • offset function has been vectorized

  • bug fixes (issues #53, #54, #55)

Changes in Version 1.0.1

  • Minor changes to achieve conformity with CRAN policies

Changes in Version 1.0.0

  • Calendar's dib argument, bizyears and bizyearse were removed

  • Load calendars from RQuantLib and timeDate (Rmetrics) packages

  • create.calendar function, Calendar have been deprecated and will be removed (not exported) soon.

  • Updated LICENSE file

  • bizdays accepts from > to arguments returning negative values in such cases

  • new following and preceding functions equal adjust.next and adjust.previous

  • new modified.following and modified.preceding functions

  • new calendar register: calendars must be created with create.calendar and are referenced by its name in bizdays methods.

Changes in Version 0.2.2

  • Calendar accepts POSIX* in holidays

  • Calendar's start.date and end.date are set to default values only when their aren't provided

  • Docs updated

Changes in Version 0.2.1

  • changed print.Calendar to be more informative

  • new offset function create (add.bizdays alias)

  • offset (add.bizdays) accepts vector of numbers (n argument)

  • updated documentation

  • added vignettes

  • renamed default.calendar to Calendar(name='Actual/365', dib=365)

Changes in Version 0.2.0

  • print.Calendar returns invisible(x) and shows weekdays

  • Calendar raises a warning when holidays is set and weekdays is not

  • Calendar's dib and name defaults to NULL

  • default.calendar is Calendar(name='Actual', dib=365)

  • bizyears raises an error if dib is NULL

  • add.bizdays performance improved

Changes in Version 0.1.5

  • add function has been renamed to add.bizdays

  • Calendar's argument weekdays default value is NULL

  • Calendar has new arguments: dib, adjust.from, adjust.to

  • travis-ci integration

  • New functions: bizyears, bizyearse, bizdayse

  • bizdays accepts NA values in both arguments, from and to

Changes in Version 0.1.4

  • bizdays, adjust.previous, adjust.next and is.bizday accept POSIXct and POSIXlt objects.

  • bizdays, adjust.previous, adjust.next and is.bizday handle NA values without break

  • bizdays, adjust.next and adjust.previous are fast

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("bizdays")

1.0.6 by Wilson Freitas, 10 months ago


https://github.com/wilsonfreitas/R-bizdays


Browse source code at https://github.com/cran/bizdays


Authors: Wilson Freitas <[email protected]>


Documentation:   PDF Manual  


Task views: Empirical Finance


MIT + file LICENSE license


Imports methods, utils, jsonlite

Suggests RQuantLib, timeDate, knitr, testthat, covr


Imported by GetTDData.


See at CRAN