Skip to content

Commit 2392a3d

Browse files
added Form 13D/13G API
1 parent a153bf0 commit 2392a3d

File tree

5 files changed

+134
-5
lines changed

5 files changed

+134
-5
lines changed

README.md

+86-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# SEC API - A SEC.gov EDGAR Filings Query & Real-Time Stream API
22

3-
**sec-api** is a Python package for querying the entire SEC filings corpus in real-time without the need to download filings.
3+
**sec-api** is a Python package allowing you to search the entire SEC filings corpus and access over 650 terabytes of data.
4+
45
It includes:
56

6-
- [Query and Full-Text Search API](#sec-edgar-filings-query-api)
7+
- [SEC Filing Search and Full-Text Search API](#sec-edgar-filings-query-api)
78
- [Real-Time Stream API](#sec-edgar-filings-real-time-stream-api)
89
- [XBRL-to-JSON Converter API + Financial Statements](#xbrl-to-json-converter-api)
910
- [10-K/10-Q/8-K Section Extraction API](#10-k10-q8-k-section-extractor-api)
@@ -15,6 +16,7 @@ It includes:
1516
- [Form N-PORT API](#form-n-port-api)
1617
- [Form D API](#form-d-api)
1718
- [Form ADV API](#form-adv-api)
19+
- [Form 13D/13G API](#form-13d-13g-api)
1820
- [Float (Outstanding Shares) API](#float-outstanding-shares-api)
1921

2022
# Data Coverage
@@ -28,8 +30,6 @@ It includes:
2830
- Every filing is **mapped to a CIK and ticker**
2931
- All filings in JSON - **no XBRL/XML**
3032

31-
Data source: [sec.gov](https://www.sec.gov/edgar/searchedgar/companysearch.html)
32-
3333
# Overview
3434

3535
- The query API gives access to all over 18 million SEC Edgar filings of **over 8000** publicly listed companies, ETFs, hedge funds, mutual funds, and investors dating back to 1993.
@@ -799,6 +799,88 @@ print(response["brochures"])
799799

800800
> See the documentation for more details: https://sec-api.io/docs/investment-adviser-and-adv-api
801801
802+
# Form 13D/13G API
803+
804+
The API allows you to easily search and access all SEC Form 13D and Form 13G filings in a standardized JSON format. You can search the database by any form field, such as the CUSIP of the acquired security, name of the security owner, or the aggregate amount owned in percetnage of total shares outstanding.
805+
806+
```python
807+
from sec_api import Form13DGApi
808+
809+
form13DGApi = Form13DGApi("YOUR_API_KEY")
810+
811+
# find the 50 most recently filed 13D/G filings disclosing 10% of more ownership of any Point72 company.
812+
query = {
813+
"query": {
814+
"query_string": {
815+
"query": "owners.name:Point72 AND owners.amountAsPercent:[10 TO *]"
816+
}
817+
},
818+
"from": "0",
819+
"size": "50",
820+
"sort": [ { "filedAt": { "order": "desc" } } ]
821+
}
822+
823+
response = form13DGApi.get_data(query)
824+
825+
print(response["filings"])
826+
```
827+
828+
> See the documentation for more details: https://sec-api.io/docs/form-13d-13g-search-api
829+
830+
### Response Example
831+
832+
```json
833+
{
834+
"total": {
835+
"value": 8,
836+
"relation": "eq"
837+
},
838+
"filings": [
839+
{
840+
"id": "bbb1ef1892bfc12a2e398c903871e3ae",
841+
"accessionNo": "0000902664-22-005029",
842+
"formType": "SC 13D",
843+
"filedAt": "2022-12-05T16:00:20-05:00",
844+
"filers": [
845+
{
846+
"cik": "1813658",
847+
"name": "Tempo Automation Holdings, Inc. (Subject)"
848+
},
849+
{
850+
"cik": "1954961",
851+
"name": "Point72 Private Investments, LLC (Filed by)"
852+
}
853+
],
854+
"nameOfIssuer": "Tempo Automation Holdings, Inc.",
855+
"titleOfSecurities": "Common Stock, par value $0.0001 per share",
856+
"cusip": ["88024M108"],
857+
"eventDate": "2022-11-22",
858+
"schedule13GFiledPreviously": false,
859+
"owners": [
860+
{
861+
"name": "Point72 Private Investments, LLC",
862+
"memberOfGroup": {
863+
"a": false,
864+
"b": false
865+
},
866+
"sourceOfFunds": ["OO"],
867+
"legalProceedingsDisclosureRequired": false,
868+
"place": "Delaware",
869+
"soleVotingPower": 0,
870+
"sharedVotingPower": 5351000,
871+
"soleDispositivePower": 0,
872+
"sharedDispositivePower": 5351000,
873+
"aggregateAmountOwned": 5351000,
874+
"amountExcludesCertainShares": false,
875+
"amountAsPercent": 20.3,
876+
"typeOfReportingPerson": ["OO"]
877+
}
878+
]
879+
}
880+
]
881+
}
882+
```
883+
802884
# Float (Outstanding Shares) API
803885

804886
The Float API returns the number of outstanding shares of any publicly traded company listed on US exchanges. The dataset includes the most recent float as well as historical float data. If a company registered multiple share classes, the API returns the number of shares outstanding of each class.

examples.py

+19
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
FormDApi,
1010
FormAdvApi,
1111
FloatApi,
12+
Form13DGApi,
1213
)
1314

1415
#
@@ -213,3 +214,21 @@
213214
response = floatApi.get_float(cik="1318605")
214215
print(response["data"])
215216
# """
217+
218+
219+
#
220+
# Form 13D/13G API Example
221+
#
222+
"""
223+
form13DGApi = Form13DGApi("YOUR_API_KEY")
224+
225+
query = {
226+
"query": {"query_string": {"query": "accessionNo:*"}},
227+
"from": "0",
228+
"size": "50",
229+
"sort": [{"filedAt": {"order": "desc"}}],
230+
}
231+
232+
response = form13DGApi.get_data(query)
233+
print(response["filings"])
234+
# """

sec_api/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
from sec_api.index import FormNportApi
1111
from sec_api.index import FormDApi
1212
from sec_api.index import FormAdvApi
13+
from sec_api.index import Form13DGApi
1314
from sec_api.index import FloatApi

sec_api/index.py

+27
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
form_nport_api_endpoint = "https://api.sec-api.io/form-nport"
1515
form_d_api_endpoint = "https://api.sec-api.io/form-d"
1616
form_adv_endpoint = "https://api.sec-api.io/form-adv"
17+
form_13D_13G_endpoint = "https://api.sec-api.io/form-13d-13g"
1718
float_api_endpoint = "https://api.sec-api.io/float"
1819

1920

@@ -451,3 +452,29 @@ def get_float(self, ticker="", cik=""):
451452
handle_api_error(response)
452453
else:
453454
handle_api_error(response)
455+
456+
457+
class Form13DGApi:
458+
"""
459+
Base class for Form 13D/13G API
460+
"""
461+
462+
def __init__(self, api_key):
463+
self.api_key = api_key
464+
self.api_endpoint = form_13D_13G_endpoint + "?token=" + api_key
465+
466+
def get_data(self, query):
467+
response = {}
468+
469+
# use backoff strategy to handle "too many requests" error.
470+
for x in range(3):
471+
response = requests.post(self.api_endpoint, json=query)
472+
if response.status_code == 200:
473+
return response.json()
474+
elif response.status_code == 429:
475+
# wait 500 * (x + 1) milliseconds and try again
476+
time.sleep(0.5 * (x + 1))
477+
else:
478+
handle_api_error(response)
479+
else:
480+
handle_api_error(response)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="sec-api",
8-
version="1.0.15",
8+
version="1.0.16",
99
author="SEC API",
1010
author_email="[email protected]",
1111
description="SEC EDGAR Filings API",

0 commit comments

Comments
 (0)