#' @title Aggregate Indicators
#' @description Get aggregate indicators
#'
#' @param symbol Stock ticker
#' @param resolution 1-minute, 5-minute, 15-minute, 30-minute, 60-minute,
#' daily, weekly and monthly
#'
#' @importFrom purrr flatten
#' @importFrom dplyr bind_rows mutate select everything
#'
#' @return
#' @export
#'
#' @examples
#' aggregate_indicators('NVDA')
#' aggregate_indicators('NVDA', resolution = '1') # Not working
#' aggregate_indicators('NVDA', resolution = '5')
#' aggregate_indicators('NVDA', resolution = '15')
#' aggregate_indicators('NVDA', resolution = '30')
#' aggregate_indicators('NVDA', resolution = '60')
#' aggregate_indicators('NVDA', resolution = 'D')
#' aggregate_indicators('NVDA', resolution = 'W')
#' aggregate_indicators('NVDA', resolution = 'M')
aggregate_indicators <- function(symbol,
resolution = 'D',
...){
url <- finnhub_endpoint('aggregate_indicators')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol,
resolution = resolution)
)
df %>%
purrr::flatten() %>%
purrr::flatten() %>%
dplyr::bind_rows() %>%
dplyr::mutate(symbol = symbol) %>%
dplyr::select(symbol, dplyr::everything())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.