R/forex_symbols.R

Defines functions forex_symbols

Documented in forex_symbols

#' @title Forex Symbols
#' @description Get symbols from currency exchanges
#'   
#' @param exchange Forex exchange - oanda, fxcm, forex.com, ic markets, etc.
#' 
#' @importFrom purrr set_names
#' @importFrom tibble as_tibble
#' 
#' @return
#' @export
#' 
#' @examples
#' forex_symbols(forex_exchange = 'oanda')
#' forex_symbols(forex_exchange = 'fxcm')
#' forex_symbols(forex_exchange = 'forex.com')
#' forex_symbols(forex_exchange = 'ic markets')
#' forex_symbols(forex_exchange = 'octafx')
#' forex_symbols(forex_exchange = 'fxpig')
#' forex_symbols(forex_exchange = 'pepperstone')
#' forex_symbols(forex_exchange = 'fxpro')
#' forex_symbols(forex_exchange = 'icmtrader')
#' 
#' all_exchanges <- purrr::map(forex_exchanges() %>% purrr::pull(), 
#' forex_symbols) %>% 
#  dplyr::bind_rows
forex_symbols <- function(forex_exchange = 'oanda', ...){
  
  url <- finnhub_endpoint('forex_symbols')
  
  df <- retry_get(url, 
                  query = list(token = finnhub_key(),
                               exchange = forex_exchange)
  )
  df %>% 
    purrr::set_names(c('description', 'display_symbol', 'symbol')) %>% 
    tibble::as_tibble()
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.