Skip to content

Commit cd13a10

Browse files
v0
0 parents  commit cd13a10

6 files changed

Lines changed: 310 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
env
2+
dist
3+
build
4+
.idea

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 The Python Packaging Authority
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# sec.gov EDGAR filings real-time API
2+
3+
- Covers SEC Edgar filings for **over 8000** publicly listed companies, ETFs, hedge funds, mutual funds, and investors.
4+
- Every filing is **mapped to a CIK and ticker**.
5+
- **Over 150 form types** are supported, eg 10-Q, 10-K, 4, 8-K, 13-F and many more.
6+
[See the list of supported form types here.](https://sec-api.io/#list-of-sec-form-types)
7+
- The API returns a new filing as soon as it is published on SEC EDGAR.
8+
- **No XBRL/XML** needed - JSON formatted.
9+
- 13F holdings API included. Monitor all institutional ownerships in real-time.
10+
- Python, R, Java, C++, Excel scripts are supported through websockets
11+
- Client- and server-side JavaScript supported (Node.js, React, React Native, Angular, Vue, etc.)
12+
- Free API key available on [sec-api.io](https://sec-api.io)
13+
14+
The official documentation explains how to use the
15+
query API to filter historical filings: [sec-api.io/docs](https://sec-api.io/docs)
16+
17+
Data source: [sec.gov](https://www.sec.gov/edgar/searchedgar/companysearch.html)
18+
19+
# Getting Started
20+
21+
You can use the API in your command line, or develop your own application
22+
using the API as imported package. Both options are explained below.
23+
24+
25+
## Command Line
26+
27+
In your command line, type
28+
29+
1. `python -m pip install sec-api` to install the package
30+
2. `sec-api YOUR_API_KEY` to connect to the stream. Replace `YOUR_API_KEY` with
31+
the API key provided on [sec-api.io](https://sec-api.io)
32+
3. Done! You will see new filings printed in your command line
33+
as soon as they are published on SEC EDGAR.
34+
35+
36+
## Python
37+
38+
- Install the socket.io client: `pip install "python-socketio[client]"`
39+
- Run the example script below. Get your free API key on [sec-api.io](https://sec-api.io)
40+
and replace `YOUR_API_KEY` with it.
41+
42+
```python
43+
import socketio
44+
45+
sio = socketio.Client()
46+
47+
@sio.on('connect', namespace='/all-filings')
48+
def on_connect():
49+
print("Connected to https://api.sec-api.io:3334/all-filings")
50+
51+
@sio.on('filing', namespace='/all-filings')
52+
def on_filings(filing):
53+
print(filing)
54+
55+
sio.connect('https://api.sec-api.io:3334?apiKey=YOUR_API_KEY', namespaces=['/all-filings'])
56+
sio.wait()
57+
```
58+
59+
60+
61+
62+
# Response Format
63+
64+
- `accessionNo` (string) - Accession number of filing, e.g. 0000028917-20-000033
65+
- `cik` (string) - CIK of the filing issuer. Important: trailing `0` are removed.
66+
- `ticker` (string) - Ticker of company, e.g. AMOT. A ticker is not available when non-publicly traded companies report filings (e.g. form 4 reported by directors). Please contact us if you find filings that you think should have tickers (but don't).
67+
- `companyName` (string) - Name of company, e.g. Allied Motion Technologies Inc
68+
- `companyNameLong` (string) - Long version of company name including the filer type (Issuer, Filer, Reporting), e.g. ALLIED MOTION TECHNOLOGIES INC (0000046129) (Issuer)
69+
- `formType` (string) - sec.gov form type, e.g 10-K. [See the list of supported form types here.](https://sec-api.io/#list-of-sec-form-types)
70+
- `description` (string) - Description of the form, e.g. Statement of changes in beneficial ownership of securities
71+
- `linkToFilingDetails` (string) - Link to HTML, XML or PDF version of the filing.
72+
- `linkToTxt` (string) - Link to the plain text version of the filing. This file can be multiple MBs large.
73+
- `linkToHtml` (string) - Link to index page of the filing listing all exhibits and the original HTML file.
74+
- `linkToXbrl` (string, optional) - Link to XBRL version of the filing (if available).
75+
- `filedAt` (string) - The date (format: YYYY-MM-DD HH:mm:SS TZ) the filing was filed, eg 2019-12-06T14:41:26-05:00.
76+
- `id` (string) - Unique ID of the filing.
77+
- `entities` (array) - A list of all entities referred to in the filing. The first item in the array always represents the filing issuer. Each array element is an object with the following keys:
78+
- `companyName` (string) - Company name of the entity, e.g. DILLARD'S, INC. (Issuer)
79+
- `cik` (string) - CIK of the entity. Trailing 0 are not removed here, e.g. 0000028917
80+
- `irsNo` (string, optional) - IRS number of the entity, e.g. 710388071
81+
- `stateOfIncorporation` (string, optional) - State of incorporation of entity, e.g. AR
82+
- `fiscalYearEnd` (string, optional) - Fiscal year end of the entity, e.g. 0201
83+
- `sic` (string, optional) - SIC of the entity, e.g. 5311 Retail-Department Stores
84+
- `type` (string, optional) - Type of the filing being filed. Same as formType, e.g. 4
85+
- `act` (string, optional) - The SEC act pursuant to which the filing was filed, e.g. 34
86+
- `fileNo` (string, optional) - Filer number of the entity, e.g. 001-06140
87+
- `filmNo` (string, optional) - Film number of the entity, e.g. 20575664
88+
- `documentFormatFiles` (array) - An array listing all primary files of the filing. The first item of the array is always the filing itself. The last item of the array is always the TXT version of the filing. All other items can represent exhibits, press releases, PDF documents, presentations, graphics, XML files, and more. An array item is represented as follows:
89+
- `sequence` (string, optional) - The sequence number of the filing, e.g. 1
90+
- `description` (string, optional) - Description of the file, e.g. EXHIBIT 31.1
91+
- `documentUrl` (string) - URL to the file on SEC.gov
92+
- `type` (string, optional) - Type of the file, e.g. EX-32.1, GRAPHIC or 10-Q
93+
- `size` (string, optional) - Size of the file, e.g. 6627216
94+
- `dataFiles` (array) - List of data files (filing attachments, exhibits, XBRL files) attached to the filing.
95+
- `sequence` (string) - Sequence number of the file, e.g. 6
96+
- `description` (string) - Description of the file, e.g. XBRL INSTANCE DOCUMENT
97+
- `documentUrl` (string) - URL to the file on SEC.gov
98+
- `type` (string, optional) - Type of the file, e.g. EX-101.INS, EX-101.DEF or EX-101.PRE
99+
- `size` (string, optional) - Size of the file, e.g. 6627216
100+
101+
## Example JSON Response
102+
103+
```json
104+
{
105+
"id": "79ad9e452ea42402df4fe55c636191d6",
106+
"accessionNo": "0001213900-21-032169",
107+
"cik": "1824149",
108+
"ticker": "JOFF",
109+
"companyName": "JOFF Fintech Acquisition Corp.",
110+
"companyNameLong": "JOFF Fintech Acquisition Corp. (Filer)",
111+
"formType": "10-Q",
112+
"description": "Form 10-Q - Quarterly report [Sections 13 or 15(d)]",
113+
"filedAt": "2021-06-11T17:25:44-04:00",
114+
"linkToTxt": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/0001213900-21-032169.txt",
115+
"linkToHtml": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/0001213900-21-032169-index.htm",
116+
"linkToXbrl": "",
117+
"linkToFilingDetails": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321_jofffintech.htm",
118+
"entities": [
119+
{
120+
"companyName": "JOFF Fintech Acquisition Corp. (Filer)",
121+
"cik": "1824149",
122+
"irsNo": "852863893",
123+
"stateOfIncorporation": "DE",
124+
"fiscalYearEnd": "1231",
125+
"type": "10-Q",
126+
"act": "34",
127+
"fileNo": "001-40005",
128+
"filmNo": "211012398",
129+
"sic": "6770 Blank Checks"
130+
}
131+
],
132+
"documentFormatFiles": [
133+
{
134+
"sequence": "1",
135+
"description": "QUARTERLY REPORT",
136+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321_jofffintech.htm",
137+
"type": "10-Q",
138+
"size": "274745"
139+
},
140+
{
141+
"sequence": "2",
142+
"description": "CERTIFICATION",
143+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321ex31-1_jofffintech.htm",
144+
"type": "EX-31.1",
145+
"size": "12209"
146+
},
147+
{
148+
"sequence": "3",
149+
"description": "CERTIFICATION",
150+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321ex31-2_jofffintech.htm",
151+
"type": "EX-31.2",
152+
"size": "12220"
153+
},
154+
{
155+
"sequence": "4",
156+
"description": "CERTIFICATION",
157+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321ex32-1_jofffintech.htm",
158+
"type": "EX-32.1",
159+
"size": "4603"
160+
},
161+
{
162+
"sequence": "5",
163+
"description": "CERTIFICATION",
164+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/f10q0321ex32-2_jofffintech.htm",
165+
"type": "EX-32.2",
166+
"size": "4607"
167+
},
168+
{
169+
"sequence": " ",
170+
"description": "Complete submission text file",
171+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/0001213900-21-032169.txt",
172+
"type": " ",
173+
"size": "2344339"
174+
}
175+
],
176+
"dataFiles": [
177+
{
178+
"sequence": "6",
179+
"description": "XBRL INSTANCE FILE",
180+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331.xml",
181+
"type": "EX-101.INS",
182+
"size": "248137"
183+
},
184+
{
185+
"sequence": "7",
186+
"description": "XBRL SCHEMA FILE",
187+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331.xsd",
188+
"type": "EX-101.SCH",
189+
"size": "43550"
190+
},
191+
{
192+
"sequence": "8",
193+
"description": "XBRL CALCULATION FILE",
194+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331_cal.xml",
195+
"type": "EX-101.CAL",
196+
"size": "21259"
197+
},
198+
{
199+
"sequence": "9",
200+
"description": "XBRL DEFINITION FILE",
201+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331_def.xml",
202+
"type": "EX-101.DEF",
203+
"size": "182722"
204+
},
205+
{
206+
"sequence": "10",
207+
"description": "XBRL LABEL FILE",
208+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331_lab.xml",
209+
"type": "EX-101.LAB",
210+
"size": "309660"
211+
},
212+
{
213+
"sequence": "11",
214+
"description": "XBRL PRESENTATION FILE",
215+
"documentUrl": "https://www.sec.gov/Archives/edgar/data/1824149/000121390021032169/joff-20210331_pre.xml",
216+
"type": "EX-101.PRE",
217+
"size": "186873"
218+
}
219+
],
220+
"seriesAndClassesContractsInformation": [],
221+
"periodOfReport": "2021-03-31",
222+
"effectivenessDate": "2021-03-31"
223+
}
224+
```
225+
226+
# Contact
227+
228+
Let me know how I can improve the library or if you have any feature
229+
suggestions. I'm happy to implement them.
230+
231+
support@sec-api.io

index.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import socketio
2+
import pprint
3+
4+
pp = pprint.PrettyPrinter(indent=4)
5+
sio = socketio.Client()
6+
7+
server_url = 'https://api.sec-api.io:3334'
8+
api_key = '7d2ea0730f7b2a1fff304b1e91abf634cd020a14e0ed0b6535f22f2443a18f30'
9+
connection_string = server_url + '?apiKey=' + api_key
10+
11+
12+
@sio.on('connect', namespace='/all-filings')
13+
def on_connect():
14+
print("Connected to https://api.sec-api.io:3334")
15+
16+
17+
@sio.on('filing', namespace='/all-filings')
18+
def on_filing(filing):
19+
formatted = pp.pformat(filing)
20+
print(formatted)
21+
22+
23+
@sio.on('error', namespace='/all-filings')
24+
def on_error(error):
25+
print("Error", error)
26+
27+
28+
@sio.event
29+
def disconnect():
30+
print('Disconnected from server')
31+
32+
33+
sio.connect(connection_string, namespaces=['/all-filings'])
34+
sio.wait()

sec-api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = "sec-api"

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import setuptools
2+
3+
with open("README.md", "r") as fh:
4+
long_description = fh.read()
5+
6+
setuptools.setup(
7+
name="sec-api",
8+
version="0.0.1",
9+
author="SEC API",
10+
author_email="support@sec-api.io",
11+
description="SEC EDGAR Filings API",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/pypa/sampleproject",
15+
packages=setuptools.find_packages(),
16+
classifiers=[
17+
"Programming Language :: Python :: 3",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
],
21+
)

0 commit comments

Comments
 (0)