#' @title Company Upgrade/Downgrade
#' @description Get upgrade and downgrade recommendations
#'
#' @param symbol Stock ticker
#' @param from Begin date
#' @param to End date
#'
#' @importFrom purrr set_names
#' @importFrom dplyr mutate select everything
#' @importFrom lubridate as_datetime
#'
#' @return
#' @export
#'
#' @examples
#' upgrade_downgrade('NVDA', from = lubridate::today() - 720)
upgrade_downgrade <- function(symbol,
from = lubridate::today(tz = finnhub_timezone) - 30,
to = lubridate::today(tz = finnhub_timezone), ...){
url <- finnhub_endpoint('upgrade_downgrade')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol,
from = from,
to = to))
df %>%
dplyr::mutate(grade_date = lubridate::as_datetime(gradeTime,
tz = 'UTC')) %>%
dplyr::select(symbol, grade_date, dplyr::everything()) %>%
purrr::set_names(c('symbol', 'grade_date', 'grade_time', 'company', 'from_grade',
'to_grade', 'action'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.