#' @title Stock Dividends
#' @description Get history of stock dividends paid
#'
#' @param symbol Stock ticker
#' @param from Begin date
#' @param to End date
#'
#' @importFrom purrr set_names
#' @importFrom dplyr mutate
#' @importFrom lubridate today ymd
#'
#' @return
#' @export
#'
#' @examples
#' stock_dividends('NVDA')
stock_dividends <- function(symbol,
from = lubridate::today(tz = finnhub_timezone) - 365,
to = lubridate::today(tz = finnhub_timezone), ...){
url <- finnhub_endpoint('stock_dividends')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol,
from = from,
to = to))
df %>%
dplyr::mutate(date = lubridate::ymd(date, tz = finnhub_timezone)) %>%
purrr::set_names(c('symbol', 'date', 'amount', 'adjusted_amount',
'pay_date', 'record_date', 'declaration_date', 'currency'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.