#' @title Balance Sheet
#' @description Balance sheet for a company - annual, quarterly
#'
#' @param symbol Ticker symbol
#' @param freq Frequency - annual or quarterly
#'
#' @importFrom purrr set_names
#' @importFrom dplyr mutate select everything
#' @importFrom lubridate ymd now
#'
#' @return
#' @export
#'
#' @examples
#' balance_sheet('BAC', freq = 'annual')
#' balance_sheet('CAT', freq = 'quarterly')
balance_sheet <- function(symbol, freq = 'annual', ...){
url <- finnhub_endpoint('balance_sheet')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol,
statement = 'bs',
freq = freq))
df %>%
.[['financials']] %>%
dplyr::mutate(symbol = symbol,
period = lubridate::ymd(period, tz = finnhub_timezone),
frequency = freq,
statement = 'balance_sheet',
query_date = lubridate::now(tz = finnhub_timezone)) %>%
dplyr::select(symbol, frequency, statement, period, dplyr::everything())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.