R/company_symbols.R

Defines functions company_symbols

Documented in company_symbols

#' @title Company symbols
#' @description Get a list of available stock symbols
#' 
#' @param exchange Stock exchange.  See available_exchanges() data
#' 
#' @importFrom dplyr mutate
#' @importFrom purrr set_names

#' @return
#' @export
#' 
#' @examples
#' company_symbols(exchange = 'US')
company_symbols <- function(exchange, ...){
  
  url <- finnhub_endpoint('company_symbols')
  
  retry_get(url, 
            query = list(token = finnhub_key(),
                         exchange = exchange)) %>% 
    dplyr::mutate(exchange = exchange) %>% 
    purrr::set_names(c('currency', 'description', 'display_symbol', 'symbol', 'type', 'exchange'))
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.