R/fund_ownership.R

Defines functions fund_ownership

Documented in fund_ownership

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