tradingDays: Select Trading Days

View source: R/utils.R

tradingDaysR Documentation

Select Trading Days

Description

Used by ichimoku to subset a vector of dates to trading days.

Usage

tradingDays(x, holidays, ...)

Arguments

x

a vector of POSIXct date objects.

holidays

(optional) a vector, or function which outputs a vector, of dates defined as holidays. Set to NULL for a continuously-traded market.

...

other arguments not used by this function.

Details

New Year's Day (01-01) and Christmas Day (12-25) are defined as holidays by default if 'holidays' is not specified.

Value

A vector of logical values: TRUE if the corresponding element of 'x' is a weekday and not a holiday, FALSE otherwise.

Or, if the parameter 'holidays' is set to NULL, a vector of TRUE values of the same length as 'x'.

Examples

dates <- seq(from = as.POSIXct("2020-01-01"), by = "1 day", length.out = 7)
dates
tradingDays(dates)
tradingDays(dates, holidays = c("2020-01-02", "2020-01-03"))
tradingDays(dates, holidays = NULL)


ichimoku documentation built on May 23, 2022, 9:05 a.m.