clock: Get Clock function

View source: R/Clock.R

clockR Documentation

Get Clock function

Description

The clock API serves the current market timestamp, whether or not the market is currently open, as well as the times of the next market open and close. See Clock Endpoint for details. Additionally, if your current timezone is different than that of the market or if a tz is specified, a local POSIXct will be appended with corresponding local time (or tz time) and it's offset from the market for each of the following outputs: timestamp, next_open, and next_close.

Usage

clock(tz = Sys.getenv("TZ"))

Arguments

tz

(character) A timezone (See timezones or use OlsonNames()) to determine how the market hours compare to the tz hours. If no tz argument is provided, and the local timezone differs from "America/New_York", clock will automatically provide the local conversion and offset.

Value

Clock (list) A Clock Object:

  • timestamp (POSIXct) Current timestamp.

  • is_open (logical) Whether or not the market is open as a boolean.

  • next_open (POSIXct) Next market open timestamp as a string.

  • next_close (POSIXct) Next market close timestamp as a string.

Examples

## Not run: 
clock()

## End(Not run)

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