R/investor_ownership.R

Defines functions investor_ownership

Documented in investor_ownership

#' @title Investor ownership
#' @description Investor ownership in a company
#'  
#' @param symbol Ticker symbol
#' 
#' @importFrom purrr set_names
#' @importFrom dplyr mutate
#' @importFrom lubridate ymd
#' 
#' @return
#' @export
#' 
#' @examples
#' investor_ownership('NVDA')
investor_ownership <- function(symbol, ...){
  
  url <- finnhub_endpoint('investor_ownership')
  
  df <- retry_get(url, 
                  query = list(token = finnhub_key(),
                               symbol = symbol)) 
  df %>% 
    .[['ownership']] %>% 
    purrr::set_names(c('name', 'share', 'change', 'filing_date')) %>% 
    dplyr::mutate(filing_date = lubridate::ymd(filing_date, tz = finnhub_timezone))
}
threadingdata/finnhubr documentation built on Aug. 10, 2020, 12:48 a.m.