Skip to content

Commit 7023ed3

Browse files
added SEC Litigation Releases API, struct. data of Form 8K Item 4.01 and 5.02, EDGAR Entities Database
1 parent fc4bbe8 commit 7023ed3

File tree

5 files changed

+256
-11
lines changed

5 files changed

+256
-11
lines changed

README.md

Lines changed: 97 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ It includes:
3434

3535
**Structured Material Event Data from Form 8-K**
3636

37+
- [Auditor and Accountant Changes (Item 4.01)](#auditor-and-accountant-changes-item-401)
3738
- [Financial Restatements & Non-Reliance on Prior Financial Results (Item 4.02)](#financial-restatements--non-reliance-on-prior-financial-results-item-402)
39+
- [Changes of Directors, Board Members and Compensation Plans (Item 5.02)](#changes-of-directors-executives-board-members-and-compensation-plans-item-502)
3840

3941
**Public Company Data**
4042

@@ -45,12 +47,14 @@ It includes:
4547

4648
**Enforcement Actions & SRO Filings:**
4749

50+
- [SEC Litigation Releases](#sec-litigation-releases-database-api)
4851
- [AAER Database API - Accounting and Auditing Enforcement Releases](#aaer-database-api)
4952
- [SRO Filings Database API](#sro-filings-database-api)
5053

5154
**Other APIs:**
5255

5356
- [CUSIP/CIK/Ticker Mapping API](#cusipcikticker-mapping-api)
57+
- [EDGAR Entities Database API](#edgar-entities-database)
5458

5559
## Data Coverage
5660

@@ -837,28 +841,71 @@ print(response["offerings"])
837841

838842
> See the documentation for more details: https://sec-api.io/docs/form-d-xml-json-api
839843
840-
## Financial Restatements & Non-Reliance on Prior Financial Results (Item 4.02)
844+
## Structured Data of Material Event Disclosures under Form 8-K
841845

842-
Access and search all financial restatements and non-reliance on prior financial results filings from 2004 to present. The database includes information about the CIK, ticker and company name the restatement is associated with, the publication date of the restatement, list of identified issues, affected reporting periods that require restatement, affected financial statement items, auditor involvement, and more.
846+
### Auditor and Accountant Changes (Item 4.01)
847+
848+
Access and search over 25,000 change-of-accountant disclosures under Item 4.01 in SEC Form 8-K filings, spanning from 2004 to present. Access information about former and newly appointed auditors, the reason for the change, the date of the change, the type of engagement, statements regarding material weaknesses in internal controls, and more.
843849

844850
```python
845-
from sec_api import Item_4_02_Api
851+
from sec_api import Form_8K_Item_X_Api
846852

847-
item_4_02_api = Item_4_02_Api("YOUR_API_KEY")
853+
item_X_api = Form_8K_Item_X_Api("YOUR_API_KEY")
848854

849-
query = {
850-
"query": "ticker:*",
851-
"from": "0",
855+
item_4_01_request = {
856+
"query": "item4_01:* AND filedAt:[2024-01-01 TO 2024-12-31]",
857+
"from": "0", # increase by 50 to fetch the next 50 results
852858
"size": "50",
853859
"sort": [{"filedAt": {"order": "desc"}}],
854860
}
861+
item_4_01_response = item_X_api.get_data(item_4_01_request)
862+
print(item_4_01_response["data"])
863+
```
855864

856-
response = item_4_02_api.get_data(query)
857-
print(response["data"])
865+
> See the documentation for more details: https://sec-api.io/docs/form-8k-data-item4-1-search-api
866+
867+
### Financial Restatements & Non-Reliance on Prior Financial Results (Item 4.02)
868+
869+
Access and search over 8,000 financial restatements and non-reliance on prior financial results filings from 2004 to present. The database includes information about the CIK, ticker and company name the restatement is associated with, the publication date of the restatement, list of identified issues, affected reporting periods that require restatement, affected financial statement items, auditor involvement, and more.
870+
871+
```python
872+
from sec_api import Form_8K_Item_X_Api
873+
874+
item_X_api = Form_8K_Item_X_Api("YOUR_API_KEY")
875+
876+
item_4_02_request = {
877+
"query": "item4_02:* AND filedAt:[2024-01-01 TO 2024-12-31]",
878+
"from": "0",
879+
"size": "50",
880+
"sort": [{"filedAt": {"order": "desc"}}],
881+
}
882+
item_4_02_response = item_X_api.get_data(item_4_02_request)
883+
print(item_4_02_response["data"])
858884
```
859885

860886
> See the documentation for more details: https://sec-api.io/docs/form-8k-data-search-api
861887
888+
### Changes of Directors, Executives, Board Members and Compensation Plans (Item 5.02)
889+
890+
Access and search over 250,000 changes of directors, executives, board members and compensation plans disclosures under Item 5.02 in SEC Form 8-K filings, spanning from 2004 to present. The database includes information about the CIK, ticker and company name the change is associated with, the publication date of the change, the name of the director, her/his age, position, academic affiliations, compensation details, committee memberships, and more.
891+
892+
```python
893+
from sec_api import Form_8K_Item_X_Api
894+
895+
item_X_api = Form_8K_Item_X_Api("YOUR_API_KEY")
896+
897+
item_5_02_request = {
898+
"query": "item5_02:* AND filedAt:[2024-01-01 TO 2024-12-31]",
899+
"from": "0",
900+
"size": "50",
901+
"sort": [{"filedAt": {"order": "desc"}}],
902+
}
903+
item_5_02_response = item_X_api.get_data(item_5_02_request)
904+
print(item_5_02_response["data"])
905+
```
906+
907+
> See the documentation for more details: https://sec-api.io/docs/form-8k-data-item5-2-search-api
908+
862909
## Directors & Board Members Data API
863910

864911
Access and search the entire database of all directors and board members of all publicly listed companies on US stock exchanges. The database includes information about the CIK, ticker and company name the director is associated with, the name of the director, her/his age, position, director class, date of first election, independence status, committee memberships as well as qualifications and experiences.
@@ -1077,6 +1124,28 @@ print(response["data"])
10771124

10781125
> See the documentation for more details: https://sec-api.io/docs/aaer-database-api
10791126
1127+
## SEC Litigation Releases Database API
1128+
1129+
Access and search the SEC Litigation Releases database. The database includes metadata and extracted structured data from all SEC Litigation Releases filed from 1995 to present.
1130+
1131+
```python
1132+
from sec_api import SecLitigationApi
1133+
1134+
secLitigationApi = SecLitigationApi("YOUR_API_KEY")
1135+
1136+
query = {
1137+
"query": "releasedAt:[2024-01-01 TO 2024-12-31]",
1138+
"from": "0",
1139+
"size": "50",
1140+
"sort": [{"releasedAt": {"order": "desc"}}],
1141+
}
1142+
1143+
response = secLitigationApi.get_data(query)
1144+
print(response["data"])
1145+
```
1146+
1147+
> See the documentation for more details: https://sec-api.io/docs/sec-litigation-releases-database-api
1148+
10801149
## SRO Filings Database API
10811150

10821151
Access and search all SRO filings published from 1995 to present. The database includes more than 30,000 SRO filings from all types of organizations, including National Securities Exchanges (NYSE, NASDAQ, CBOE, etc.), Joint Industry Plans, FINRA, Futures Exchanges (CME, CBOT, etc.), and more.
@@ -1176,6 +1245,25 @@ result4 = mappingApi.resolve("exchange", "NASDAQ")
11761245

11771246
> See the documentation for more details: https://sec-api.io/docs/mapping-api
11781247
1248+
## EDGAR Entities Database
1249+
1250+
Access information on over 800,000 EDGAR filing entities that have filed with the SEC since 1994. The database includes information about the CIK, IRS number, state of incorporation, fiscal year end, SIC code, current auditor, latest ICFR audit date, filer category, and more.
1251+
1252+
```python
1253+
edgarEntitiesApi = EdgarEntitiesApi("YOUR_API_KEY")
1254+
1255+
search_request = {
1256+
"query": "cik:1318605",
1257+
"from": "0",
1258+
"size": "50",
1259+
"sort": [{"cikUpdatedAt": {"order": "desc"}}],
1260+
}
1261+
response = edgarEntitiesApi.get_data(search_request)
1262+
print(response["data"])
1263+
```
1264+
1265+
> See the documentation for more details: https://sec-api.io/docs/edgar-entities-database-api
1266+
11791267
## Proxy Support
11801268

11811269
In certain cases, your corporate IT infrastructure may encounter issues with HTTPS requests, leading to SSL certificate errors. To resolve this, HTTP and HTTPS proxies can be passed into all API wrappers as shown in the example below. If you're unsure about which proxies to use, please consult your company's IT administrator.

examples.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
PdfGeneratorApi,
44
XbrlApi,
55
ExtractorApi,
6-
MappingApi,
76
DirectorsBoardMembersApi,
87
ExecCompApi,
98
InsiderTradingApi,
@@ -15,8 +14,12 @@
1514
Form_S1_424B4_Api,
1615
SubsidiaryApi,
1716
AaerApi,
17+
SecLitigationsApi,
1818
SroFilingsApi,
1919
Item_4_02_Api,
20+
Form_8K_Item_X_Api,
21+
MappingApi,
22+
EdgarEntitiesApi,
2023
)
2124

2225
#
@@ -346,6 +349,24 @@
346349
# """
347350

348351

352+
#
353+
# SEC Litigation Releases API Example
354+
#
355+
"""
356+
secLitigationsApi = SecLitigationsApi("YOUR_API_KEY")
357+
358+
query = {
359+
"query": "releasedAt:[2024-01-01 TO 2024-12-31]",
360+
"from": "0",
361+
"size": "50",
362+
"sort": [{"releasedAt": {"order": "desc"}}],
363+
}
364+
365+
response = secLitigationsApi.get_data(query)
366+
print(response["data"])
367+
# """
368+
369+
349370
#
350371
# SRO Filings API Example
351372
#
@@ -378,3 +399,44 @@
378399
response = item_4_02_api.get_data(query)
379400
print(response["data"])
380401
# """
402+
403+
#
404+
# Form 8-K Item X API Examples
405+
#
406+
"""
407+
item_X_api = Form_8K_Item_X_Api("YOUR_API_KEY")
408+
409+
item_4_01_request = {
410+
"query": "item4_01:* AND filedAt:[2024-01-01 TO 2024-12-31]",
411+
"from": "0", # increase by 50 to fetch the next 50 results, e.g. 50 (=page 2), 100 (=page 3), 150 (=page 4), ...
412+
"size": "50",
413+
"sort": [{"filedAt": {"order": "desc"}}],
414+
}
415+
item_4_01_response = item_X_api.get_data(item_4_01_request)
416+
print(item_4_01_response["data"])
417+
418+
item_5_02_request = {
419+
"query": "item5_02:* AND filedAt:[2024-01-01 TO 2024-12-31]",
420+
"from": "0", # increase by 50 to fetch the next 50 results, e.g. 50 (=page 2), 100 (=page 3), 150 (=page 4), ...
421+
"size": "50",
422+
"sort": [{"filedAt": {"order": "desc"}}],
423+
}
424+
item_5_02_response = item_X_api.get_data(item_5_02_request)
425+
print(item_5_02_response["data"])
426+
# """
427+
428+
#
429+
# EDGAR Entities Database API Example
430+
#
431+
"""
432+
edgarEntitiesApi = EdgarEntitiesApi("YOUR_API_KEY")
433+
434+
search_request = {
435+
"query": "cik:1318605",
436+
"from": "0",
437+
"size": "50",
438+
"sort": [{"cikUpdatedAt": {"order": "desc"}}],
439+
}
440+
response = edgarEntitiesApi.get_data(search_request)
441+
print(response["data"])
442+
# """

sec_api/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727

2828
# Structured data from Form 8-Ks
2929
from sec_api.index import Item_4_02_Api
30+
from sec_api.index import Form_8K_Item_X_Api
3031

3132
# Other APIs
3233
from sec_api.index import MappingApi
34+
from sec_api.index import EdgarEntitiesApi
3335
from sec_api.index import FloatApi
3436
from sec_api.index import SubsidiaryApi
3537
from sec_api.index import AaerApi
38+
from sec_api.index import SecLitigationsApi
3639
from sec_api.index import SroFilingsApi

sec_api/index.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
form_d_api_endpoint = "https://api.sec-api.io/form-d"
2121
#
2222
form_8K_item_4_02_api_endpoint = "https://api.sec-api.io/form-8k"
23+
form_8K_item_x_api_endpoint = "https://api.sec-api.io/form-8k"
2324
#
2425
exec_comp_api_endpoint = "https://api.sec-api.io/compensation"
2526
directors_board_members_api_endpoint = (
@@ -29,9 +30,11 @@
2930
subsidiary_endpoint = "https://api.sec-api.io/subsidiaries"
3031
#
3132
aaer_search_endpoint = "https://api.sec-api.io/aaers"
33+
sec_litigations_search_endpoint = "https://api.sec-api.io/sec-litigation-releases"
3234
sro_search_endpoint = "https://api.sec-api.io/sro"
3335
#
3436
mapping_api_endpoint = "https://api.sec-api.io/mapping"
37+
edgar_entities_endpoint = "https://api.sec-api.io/edgar-entities"
3538

3639

3740
def handle_api_error(response):
@@ -729,6 +732,36 @@ def get_data(self, query):
729732
handle_api_error(response)
730733

731734

735+
class SecLitigationsApi:
736+
"""
737+
Base class for SEC Litigation Releases API
738+
https://sec-api.io/docs/sec-litigation-releases-database-api
739+
"""
740+
741+
def __init__(self, api_key, proxies=None):
742+
self.api_key = api_key
743+
self.api_search_endpoint = sec_litigations_search_endpoint + "?token=" + api_key
744+
self.proxies = proxies if proxies else {}
745+
746+
def get_data(self, query):
747+
response = {}
748+
749+
# use backoff strategy to handle "too many requests" error.
750+
for x in range(3):
751+
response = requests.post(
752+
self.api_search_endpoint, json=query, proxies=self.proxies
753+
)
754+
if response.status_code == 200:
755+
return response.json()
756+
elif response.status_code == 429:
757+
# wait 500 * (x + 1) milliseconds and try again
758+
time.sleep(0.5 * (x + 1))
759+
else:
760+
handle_api_error(response)
761+
else:
762+
handle_api_error(response)
763+
764+
732765
class SroFilingsApi:
733766
"""
734767
Base class for SRO Filings Database API
@@ -759,6 +792,35 @@ def get_data(self, query):
759792
handle_api_error(response)
760793

761794

795+
class Form_8K_Item_X_Api:
796+
"""
797+
Base class for Form 8-K Item X API
798+
"""
799+
800+
def __init__(self, api_key, proxies=None):
801+
self.api_key = api_key
802+
self.api_endpoint = form_8K_item_x_api_endpoint + "?token=" + api_key
803+
self.proxies = proxies if proxies else {}
804+
805+
def get_data(self, query):
806+
response = {}
807+
808+
# use backoff strategy to handle "too many requests" error.
809+
for x in range(3):
810+
response = requests.post(
811+
self.api_endpoint, json=query, proxies=self.proxies
812+
)
813+
if response.status_code == 200:
814+
return response.json()
815+
elif response.status_code == 429:
816+
# wait 500 * (x + 1) milliseconds and try again
817+
time.sleep(0.5 * (x + 1))
818+
else:
819+
handle_api_error(response)
820+
else:
821+
handle_api_error(response)
822+
823+
762824
class Item_4_02_Api:
763825
"""
764826
Base class for Form 8-K Item 4.02 API
@@ -786,3 +848,33 @@ def get_data(self, query):
786848
handle_api_error(response)
787849
else:
788850
handle_api_error(response)
851+
852+
853+
class EdgarEntitiesApi:
854+
"""
855+
Base class for EDGAR Entities Database API
856+
https://sec-api.io/docs/edgar-entities-database-api
857+
"""
858+
859+
def __init__(self, api_key, proxies=None):
860+
self.api_key = api_key
861+
self.api_endpoint = edgar_entities_endpoint + "?token=" + api_key
862+
self.proxies = proxies if proxies else {}
863+
864+
def get_data(self, query):
865+
response = {}
866+
867+
# use backoff strategy to handle "too many requests" error.
868+
for x in range(3):
869+
response = requests.post(
870+
self.api_endpoint, json=query, proxies=self.proxies
871+
)
872+
if response.status_code == 200:
873+
return response.json()
874+
elif response.status_code == 429:
875+
# wait 500 * (x + 1) milliseconds and try again
876+
time.sleep(0.5 * (x + 1))
877+
else:
878+
handle_api_error(response)
879+
else:
880+
handle_api_error(response)

0 commit comments

Comments
 (0)