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:
library(bizdays) bizdays("2022-02-01", "2022-02-28", "Brazil/ANBIMA")
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()
That lists calendars registered in the calendar register. Once you have a calendar registered you can simply use its name in the functions.
bizdays("2022-02-01", "2022-02-28", "actual")
You can look specificaly at one calendar by doing
calendars()[["Brazil/B3"]]
Calendars can be loaded from packages RQuantlib and timeDate (Rmetrics).
load_rmetrics_calendars(2000:2030) calendars()
Once you have calendars loaded they can be directly used by its name.
bizdays("2022-02-01", "2022-02-28", "Rmetrics/NYSE")
So, unless you really need a new calendar, you don't have to create them.
bizdays("2022-02-01", "2022-02-28", "Brazil/ANBIMA")
getbizdays("2022-01", "Brazil/ANBIMA")
is.bizday(c("2022-02-01", "2022-02-05"), "Brazil/ANBIMA")
following(c("2022-02-01", "2022-02-05"), "Brazil/ANBIMA") preceding(c("2022-02-01", "2022-02-05"), "Brazil/ANBIMA")
bizseq("2022-02-01", "2022-02-05", "Brazil/ANBIMA")
add.bizdays("2022-02-01", 0:5, "Brazil/ANBIMA")
getdate
getdate("first bizday", "2022-01", "Brazil/ANBIMA")
getdate("180th day", "2022", "Brazil/ANBIMA")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.