/
institutional-funds.R
54 lines (46 loc) · 1.4 KB
/
institutional-funds.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#' Form 13-F Statements
#'
#' Form 13-F statements provides position-level report of all institutional
#' investment managers with more than $100m in assets under management
#'
#' @param cik `character`. A vector of Central Index Keys (CIK)
#' @param year `numeric`. 4 digit year, e.g. `2020`. If `NULL`, the current year
#' will be taken from [Sys.Date()]. Default is `NULL`
#'
#' @return a [tibble][tibble::tibble-package]
#' @export
#' @seealso [fmp_list_ciks()]
#' @examples
#'
#' berkshire_cik <- '0001067983'
#' \donttest{
#' d <- fmp_13f(berkshire_cik)
#' }
#'
#' \donttest{
#' # 13-F forms from 2018
#' d_18 <- fmp_13f(berkshire_cik, year = 2018)
#' }
#'
fmp_13f <- function(cik, year = NULL) {
endpoint <- "form-thirteen"
year <- ifelse(is.null(year), substr(Sys.Date(), start = 1, stop = 4), year)
query_list <- list(year = year)
# TODO: Currently can only pass one year at a time.
# need to determine best way to vectorize
request_urls <- build_request_urls(cik, endpoint = endpoint, query_list = query_list)
d <- get_request_content(request_urls)
d
}
#' SEC RSS Feed
#'
#' Retrieve the most recent financial statements filed to the SEC
#'
#' @return a [tibble][tibble::tibble-package] of filing information
#' @export
fmp_sec_filings <- function() {
endpoint <- "rss_feed"
request_urls <- build_request_urls(NULL, endpoint = endpoint)
d <- get_request_content(request_urls)
d
}