Skip to content

Commit

Permalink
re-build documentation and fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
balthasars committed Mar 29, 2021
1 parent 478cc0d commit b70d51b
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 30 deletions.
19 changes: 18 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ knitr::opts_chunk$set(
<!-- 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 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

Expand Down Expand Up @@ -72,3 +72,20 @@ cs_2019 <- get_list_of_filings(
)
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)
86 changes: 57 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# {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.
only supports 13F-filings. The package works with the quarterly master
file.

## Installation

Expand All @@ -33,44 +33,54 @@ br_2015 <- get_13f(cik = cik_blackrock, year = 2015, clean_col_names = FALSE, am
#> Searching SEC filings from 2015.
#> tidysec caches the SEC's master index files for the time period you've downloaded up to now at/Users/balthasarsager/.rcache/tidysec/ .
#> Run `forget_tidysec_cache()` to delete the master indices if you no longer need them.
#> Getting Q1 master index from https://www.sec.gov/Archives/edgar/full-index/2015/QTR1/master.idx
#> Getting Q2 master index from https://www.sec.gov/Archives/edgar/full-index/2015/QTR2/master.idx
#> Getting Q3 master index from https://www.sec.gov/Archives/edgar/full-index/2015/QTR3/master.idx
#> Getting Q4 master index from https://www.sec.gov/Archives/edgar/full-index/2015/QTR4/master.idx
#> Now parsing filings...
#> Searching SEC filings from 2015.
#> tidysec caches the SEC's master index files for the time period you've downloaded up to now at/Users/balthasarsager/.rcache/tidysec/ .
#> Run `forget_tidysec_cache()` to delete the master indices if you no longer need them.
#> 👍Those filings are ready now, hehe.
br_2015
#> # A tibble: 4 x 7
#> # A tibble: 4 x 21
#> cik company_name form_type date_filed quarter link_to_filing filing
#> <chr> <chr> <chr> <dbl> <dbl> <chr> <list>
#> 1 13647… BlackRock In… 13F-HR 2015 1 https://www.sec.gov… <tibbl…
#> 2 13647… BlackRock In… 13F-HR 2015 2 https://www.sec.gov… <tibbl…
#> 3 13647… BlackRock In… 13F-HR 2015 3 https://www.sec.gov… <tibbl…
#> 4 13647… BlackRock In… 13F-HR 2015 4 https://www.sec.gov… <tibbl…
#> # … with 14 more variables: filing_number <chr>, submissionType <chr>,
#> # filingManager <chr>, reportType <chr>, periodOfReport <chr>,
#> # reportCalendarOrQuarter <chr>, form13FFileNumber <chr>,
#> # stateOrCountry <chr>, signatureDate <chr>, tableEntryTotal <chr>,
#> # tableValueTotal <chr>, otherIncludedManagersCount <chr>,
#> # otherManagers2Info <chr>, link_to_primary_doc <chr>
```

To work with the filing(s), use `tidyr::unnest()`:

``` r
br_2015 %>%
tidyr::unnest(filing)
#> # A tibble: 31,298 x 16
#> cik company_name form_type date_filed quarter link_to_filing issuer class
#> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 1ST S… COM
#> 2 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 21VIA… SPON…
#> 3 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3-D S… COM …
#> 4 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3-D S… COM …
#> 5 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3-D S… COM …
#> 6 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3M CO COM
#> 7 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3M CO COM
#> 8 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3M CO COM
#> 9 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3M CO COM
#> 10 1364… BlackRock I… 13F-HR 2015 1 https://www.s… 3M CO COM
#> # … with 31,288 more rows, and 8 more variables: cusip <chr>, value <dbl>,
#> # A tibble: 31,298 x 30
#> cik company_name form_type date_filed quarter link_to_filing issuer class
#> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 1ST S… COM
#> 2 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 21VIA… SPON…
#> 3 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3-D S… COM …
#> 4 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3-D S… COM …
#> 5 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3-D S… COM …
#> 6 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3M CO COM
#> 7 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3M CO COM
#> 8 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3M CO COM
#> 9 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3M CO COM
#> 10 13647… BlackRock I… 13F-HR 2015 1 https://www.se… 3M CO COM
#> # … with 31,288 more rows, and 22 more variables: cusip <chr>, value <dbl>,
#> # shrsorprnamt <dbl>, sshprnamttype <chr>, investment_discretion <chr>,
#> # voting_authority_sole <dbl>, voting_authority_shared <dbl>,
#> # voting_authority_none <dbl>
#> # voting_authority_none <dbl>, filing_number <chr>, submissionType <chr>,
#> # filingManager <chr>, reportType <chr>, periodOfReport <chr>,
#> # reportCalendarOrQuarter <chr>, form13FFileNumber <chr>,
#> # stateOrCountry <chr>, signatureDate <chr>, tableEntryTotal <chr>,
#> # tableValueTotal <chr>, otherIncludedManagersCount <chr>,
#> # otherManagers2Info <chr>, link_to_primary_doc <chr>
```

Amendments to 13F filings (13F-HR/A) cannot be parsed yet. However, you
Expand All @@ -80,12 +90,9 @@ and `amendments = TRUE`:
``` r
cik_blackrock <- "1364742"
get_13f(cik = cik_blackrock, year = 2015, link_only = TRUE, amendments = TRUE)
#> Warning in if (filing_type == "all") {: the condition has length > 1 and only
#> the first element will be used
#> Searching SEC filings from 2015.
#> tidysec caches the SEC's master index files for the time period you've downloaded up to now at/Users/balthasarsager/.rcache/tidysec/ .
#> Run `forget_tidysec_cache()` to delete the master indices if you no longer need them.
#> Getting Q1 master index from https://www.sec.gov/Archives/edgar/full-index/2015/QTR1/master.idx
#> # A tibble: 5 x 6
#> cik company_name form_type date_filed quarter link_to_filing
#> <chr> <chr> <chr> <dbl> <dbl> <chr>
Expand All @@ -112,11 +119,8 @@ cs_2019 <- get_list_of_filings(
#> Searching SEC filings from 2020.
#> tidysec caches the SEC's master index files for the time period you've downloaded up to now at/Users/balthasarsager/.rcache/tidysec/ .
#> Run `forget_tidysec_cache()` to delete the master indices if you no longer need them.
#> Getting Q1 master index from https://www.sec.gov/Archives/edgar/full-index/2020/QTR1/master.idx
#> Getting Q2 master index from https://www.sec.gov/Archives/edgar/full-index/2020/QTR2/master.idx
#> Getting Q3 master index from https://www.sec.gov/Archives/edgar/full-index/2020/QTR3/master.idx
cs_2019
#> # A tibble: 14 x 6
#> # A tibble: 16 x 6
#> cik company_name form_type date_filed filename quarter
#> <chr> <chr> <chr> <dbl> <chr> <dbl>
#> 1 824468 CREDIT SUISSE … 13F-HR 2020 edgar/data/824468/000156… 1
Expand All @@ -133,4 +137,28 @@ cs_2019
#> 12 824468 CREDIT SUISSE … SC 13G 2020 edgar/data/824468/000156… 1
#> 13 824468 CREDIT SUISSE … SC 13G 2020 edgar/data/824468/000156… 1
#> 14 824468 CREDIT SUISSE … 13F-HR 2020 edgar/data/824468/000156… 2
#> 15 824468 CREDIT SUISSE … 13F-HR 2020 edgar/data/824468/000156… 3
#> 16 824468 CREDIT SUISSE … 13F-HR 2020 edgar/data/824468/000156… 4
```

# 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)

0 comments on commit b70d51b

Please sign in to comment.