R/crypto_symbols.R

Defines functions crypto_symbols

Documented in crypto_symbols

#' @title Cryptocurrency Symbols for Exchange
#' @description Get symbols from selected cryptocurrency exchange
#'   
#' @param exchange Crypto Exchanges - COINBASE, GEMINI, Binance, BITFINIX, KRAKEN, etc.
#' 
#' @importFrom purrr set_names
#' 
#' @return
#' @export
#' 
#' @examples
#' crypto_symbols(exchange = 'COINBASE')
#' all_cryptos <- crypto_exchanges() %>% 
#'    dplyr::pull(crypto_exchange) %>% 
#'    purrr::map(crypto_symbols) %>% 
#'    dplyr::bind_rows()
crypto_symbols <- function(exchange = 'COINBASE', ...){
  
  url <- finnhub_endpoint('crypto_symbols')
  
  df <- retry_get(url, 
                  query = list(token = finnhub_key(),
                               exchange = exchange)
  )
  df %>% 
    purrr::set_names(c('description', 'display_symbol', 'symbol'))
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.