-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
90 lines (64 loc) · 2.36 KB
/
README.Rmd
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# `{tidysec}`
<!-- badges: start -->
<!-- badges: end -->
The goal of `{tidysec}` is to facilitate working with filings provided by the American Securities and Exchange Commission. Currently the package only supports 13F-filings. The package works with the quarterly master file.
## Installation
You can install the development version of `{tidysec}` from [Github](https://github.com/balthasars/tidysec) with:
``` r
devtools::install_github("balthasars/tidysec")
```
## Retrieve and parse a 13F-filing
Use `get_13f()` for that purpose.
This function returns the filings as a tibble with a nested data frame column.
```{r example}
library(tidysec)
library(magrittr)
cik_blackrock <- "1364742"
br_2015 <- get_13f(cik = cik_blackrock, year = 2015, amendments = FALSE)
br_2015
```
To work with the filing(s), use `tidyr::unnest()`:
```{r}
br_2015 %>%
tidyr::unnest(filing)
```
Amendments to 13F filings (13F-HR/A) cannot be parsed yet.
However, you can still get the link to their .txt file by setting `link_only = TRUE` and `amendments = TRUE`:
```{r}
cik_blackrock <- "1364742"
get_13f(cik = cik_blackrock, year = 2015, link_only = TRUE, amendments = TRUE)
```
## Get a list of all SEC filings by a company
Let's say you wanted a list of all of Credit Suisse AG's 2020 company filings.
```{r}
cik_credit_suisse <- "824468"
cs_2019 <- get_list_of_filings(
cik = cik_credit_suisse,
year = 2020,
filing_type = "all"
)
cs_2019
```
# Other Resources to Work with SEC Data
## R packages
The following packages may also be helpful to you if you're looking to work with anything else than 13F filings (I haven't tested them though):
- [`{finreportr}`](https://github.com/sewardlee337/finreportr) and/or [`{finstr}`](https://github.com/bergant/finstr)
- for accessing financial statements of companies
- [`{edgarWebR}`](https://github.com/mwaldstein/edgarWebR)
- with an emphasis on finding various kinds of filings
- [`{edgar}`](https://cran.r-project.org/web/packages/edgar/) for a variety of functions
## APIs
If you just want easy acess to filings, check out finance APIs that offer 13F filings:
- [FMP Cloud](https://fmpcloud.io)