#' @title Stock recommendation trends
#' @description Trend recommendations for stocks
#'
#' @param symbol Stock ticker
#'
#' @importFrom purrr set_names
#' @importFrom dplyr mutate select everything
#' @importFrom lubridate ymd
#'
#' @return
#' @export
#'
#' @examples
#' recommendation_trends('NVDA')
recommendation_trends <- function(symbol, ...){
url <- finnhub_endpoint('recommendation_trends')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol))
df %>%
dplyr::mutate(period = lubridate::ymd(period, tz = finnhub_timezone)) %>%
dplyr::select(symbol, period, dplyr::everything()) %>%
purrr::set_names(c('symbol', 'period', 'buy', 'hold', 'sell', 'strong_buy',
'strong_sell'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.