R/current_time.R

Defines functions current_time

Documented in current_time

#' @title Get the current time
#' @description Current time is needed for some calls - XX:XX:XX
#' 
#' @importFrom lubridate now hour minute
#' @importFrom stringr str_pad
#' 
#' @return
#'
#' @examples
#' current_time()
current_time <- function(){
  time <- lubridate::now() # Uses system time, not Eastern as with Finnhub API
  paste(stringr::str_pad(lubridate::hour(time), width = 2, side = 'left', pad = 0),
        stringr::str_pad(lubridate::minute(time), width = 2, side = 'left', pad = '0'),
        '00', 
        sep = ':')
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.