Skip to content

Commit

Permalink
Merge pull request #36 from jadchaar/feature/form4
Browse files Browse the repository at this point in the history
Added support for form 4 filings
  • Loading branch information
jadchaar committed Apr 8, 2020
2 parents 49fb27a + 34b7352 commit 3aaec88
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 3.0.3 - 4/8/2020

### Added

- Added support for form 4 filings.

## 3.0.2 - 3/9/2020

### Added
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Example Usage
Supported SEC Filings
---------------------

- 4
- 8-K
- 10-K
- 10KSB
Expand Down
1 change: 1 addition & 0 deletions sec_edgar_downloader/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

SEC_EDGAR_BASE_URL = "https://www.sec.gov/cgi-bin/browse-edgar?"
SUPPORTED_FILINGS = {
"4",
"8-K",
"10-K",
"10KSB",
Expand Down
17 changes: 14 additions & 3 deletions sec_edgar_downloader/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def validate_date_format(date_str):
)


def form_query_string(start, count, ticker_or_cik, filing_type, before_date):
def form_query_string(
start, count, ticker_or_cik, filing_type, before_date, ownership="exclude"
):
query_params = {
"action": "getcompany",
"owner": "exclude",
"owner": ownership,
"start": start,
"count": count,
"CIK": ticker_or_cik,
Expand Down Expand Up @@ -58,7 +60,16 @@ def get_filing_urls_to_download(
# (1) we get more filings than num_filings_to_download
# (2) there are no more filings to fetch
while len(filings_to_fetch) < num_filings_to_download:
qs = form_query_string(start, count, ticker_or_cik, filing_type, before_date)
# form 4 requires ownership to be set to "only" or
# else we will only fetch form 424B5
if filing_type == "4":
ownership = "only"
else:
ownership = "exclude"

qs = form_query_string(
start, count, ticker_or_cik, filing_type, before_date, ownership
)
edgar_search_url = f"{SEC_EDGAR_BASE_URL}{qs}"

resp = requests.get(edgar_search_url)
Expand Down
2 changes: 1 addition & 1 deletion sec_edgar_downloader/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.0.2"
__version__ = "3.0.3"
4 changes: 2 additions & 2 deletions tests/test_filing_url_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def test_filing_url_retrieval():


def test_common_filings():
# AAPL files 8-K, 10-K, 10-Q, SC 13G, SD
# AAPL files 4, 8-K, 10-K, 10-Q, SC 13G, SD
ticker = "AAPL"
filing_types = ["8-K", "10-K", "10-Q", "SC 13G", "SD"]
filing_types = ["4", "8-K", "10-K", "10-Q", "SC 13G", "SD"]
num_filings_to_download = 1
after_date = None
before_date = None
Expand Down

0 comments on commit 3aaec88

Please sign in to comment.