calendar: Get Market Calendar Times

View source: R/Calendar.R

calendarR Documentation

Get Market Calendar Times

Description

The calendar API serves the full list of market days from 1970 to 2029. It can also be queried by specifying a start and/or end time to narrow down the results. In addition to the dates, the response also contains the specific open and close times for the market days, taking into account early closures. See Calendar Endpoint for details.

Usage

calendar(from = NULL, to = NULL)

Arguments

from

(Date/Datetime/POSIXct/character) in YYYY-MM-DD format. Starting date of request. Defaults to today. Calendar data goes back to 1970. If blank, defaults to today's date.

to

(Date/Datetime/POSIXct/character) in YYYY-MM-DD format. Ending date of request. Default to today. Calendar data goes to 2029. If blank, defaults to today's date.

Value

Calendar tibble A Calendar Object consisting of the following:

  • date (character) vector of trading days in the time range

  • open (character) The time the market opens at on this date in hour:min format as a string.

  • close (character) The time the market closes at on this date in hour:min format as a string.

  • session_open (character) The start time of the session in hh:mm format

  • session_close (character) The closing time of the session in hh:mm format.

  • day (Interval) An interval of the market day open %--% close.

  • session (Interval) An interval of the market session session_open %--% session_close.

  • dow (character) Three letter abbreviation of the day of the week as an ordered factor with levels Sunday - Saturday.

See Also

Interval-class

Examples

## Not run: 
# Get all dates:
calendar()
# Get specific date range:
calendar(from = "2019-01-01", to = "2019-04-01")

## End(Not run)

jagg19/AlpacaforR documentation built on July 3, 2023, 12:14 p.m.