edgrapi 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edgrapi-0.1.0/LICENSE +21 -0
- edgrapi-0.1.0/PKG-INFO +111 -0
- edgrapi-0.1.0/README.md +87 -0
- edgrapi-0.1.0/edgrapi/__init__.py +123 -0
- edgrapi-0.1.0/edgrapi.egg-info/PKG-INFO +111 -0
- edgrapi-0.1.0/edgrapi.egg-info/SOURCES.txt +9 -0
- edgrapi-0.1.0/edgrapi.egg-info/dependency_links.txt +1 -0
- edgrapi-0.1.0/edgrapi.egg-info/requires.txt +1 -0
- edgrapi-0.1.0/edgrapi.egg-info/top_level.txt +1 -0
- edgrapi-0.1.0/pyproject.toml +35 -0
- edgrapi-0.1.0/setup.cfg +4 -0
edgrapi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Paper and Beyond
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
edgrapi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edgrapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiny Python client for the Edgrapi SEC EDGAR data API: financials, insider trades, 8-K events, 13F holdings, and 13D/13G stakes as clean JSON.
|
|
5
|
+
Author-email: Paper and Beyond <support@edgrapi.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://edgrapi.com
|
|
8
|
+
Project-URL: Documentation, https://edgrapi.com/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/paperandbeyond23-gif/edgrapi-python
|
|
10
|
+
Project-URL: Issues, https://github.com/paperandbeyond23-gif/edgrapi-python/issues
|
|
11
|
+
Keywords: sec,edgar,sec edgar,13f,insider trading,form 4,8-k,10-k,xbrl,financial data,financial statements,api
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: requests>=2.20
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# edgrapi
|
|
26
|
+
|
|
27
|
+
A tiny Python client for the [Edgrapi](https://edgrapi.com) SEC EDGAR data API.
|
|
28
|
+
|
|
29
|
+
Parsed SEC filings as clean JSON: company financials, insider trades (Form 4),
|
|
30
|
+
8-K events, 13F fund holdings, and 13D/13G activist stakes. There's **no LLM in
|
|
31
|
+
the data path** — every value is lifted straight from the filing, so you can
|
|
32
|
+
verify any number on EDGAR yourself.
|
|
33
|
+
|
|
34
|
+
The heavy lifting (XBRL parsing, CUSIP mapping, quarter-over-quarter diffs)
|
|
35
|
+
happens server-side, so this client stays tiny and has one dependency
|
|
36
|
+
(`requests`).
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install edgrapi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Get a free API key (100 calls/month, no card) at <https://edgrapi.com>.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from edgrapi import Client
|
|
50
|
+
|
|
51
|
+
c = Client("your_key")
|
|
52
|
+
|
|
53
|
+
# Financials — income statement, balance sheet, cash flow (normalized from XBRL)
|
|
54
|
+
c.fundamentals("AAPL")
|
|
55
|
+
c.fundamentals("AAPL", period="quarterly", limit=8)
|
|
56
|
+
c.ratios("AAPL")
|
|
57
|
+
|
|
58
|
+
# Insider trades (Form 4), scored buy vs sell
|
|
59
|
+
c.insider("NVDA")
|
|
60
|
+
|
|
61
|
+
# 8-K material events, item-coded
|
|
62
|
+
c.events("TSLA")
|
|
63
|
+
c.events("TSLA", notable=True) # skip routine 8-Ks
|
|
64
|
+
|
|
65
|
+
# 13F fund holdings, diffed against last quarter
|
|
66
|
+
c.holdings("berkshire") # famous-fund alias
|
|
67
|
+
c.holdings("burry")
|
|
68
|
+
|
|
69
|
+
# 13D / 13G activist stakes
|
|
70
|
+
c.activist("AAPL")
|
|
71
|
+
|
|
72
|
+
# Company profile + CIK, and recent filings
|
|
73
|
+
c.company("MSFT")
|
|
74
|
+
c.filings("MSFT", form="10-K")
|
|
75
|
+
|
|
76
|
+
# Extracted 10-K / 10-Q sections (business, risk factors, MD&A)
|
|
77
|
+
c.sections("AAPL")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Every method returns the parsed JSON body as a `dict`.
|
|
81
|
+
|
|
82
|
+
## Errors
|
|
83
|
+
|
|
84
|
+
Failed calls raise `EdgrapiError`, which carries the HTTP status and the
|
|
85
|
+
server's detail:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from edgrapi import Client, EdgrapiError
|
|
89
|
+
|
|
90
|
+
c = Client("your_key")
|
|
91
|
+
try:
|
|
92
|
+
c.fundamentals("NOTATICKER")
|
|
93
|
+
except EdgrapiError as e:
|
|
94
|
+
print(e.status, e.detail) # e.g. 404 unknown ticker
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Common statuses: `401` bad key, `402` / `429` out of credits, `404` unknown
|
|
98
|
+
ticker. Calls that return no data are not charged. The exact credit cost of each
|
|
99
|
+
call comes back in the `X-Credits-Cost` response header, and your remaining
|
|
100
|
+
balance in `X-Credits-Remaining`.
|
|
101
|
+
|
|
102
|
+
## Notes
|
|
103
|
+
|
|
104
|
+
- This is a thin HTTP client. The API it talks to is a hosted service; if you'd
|
|
105
|
+
rather run everything locally with no API key, [edgartools](https://github.com/dgunning/edgartools)
|
|
106
|
+
is an excellent open-source library that parses EDGAR on your own machine.
|
|
107
|
+
- Data is public SEC EDGAR content, surfaced for research. Not investment advice.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
[MIT](LICENSE).
|
edgrapi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# edgrapi
|
|
2
|
+
|
|
3
|
+
A tiny Python client for the [Edgrapi](https://edgrapi.com) SEC EDGAR data API.
|
|
4
|
+
|
|
5
|
+
Parsed SEC filings as clean JSON: company financials, insider trades (Form 4),
|
|
6
|
+
8-K events, 13F fund holdings, and 13D/13G activist stakes. There's **no LLM in
|
|
7
|
+
the data path** — every value is lifted straight from the filing, so you can
|
|
8
|
+
verify any number on EDGAR yourself.
|
|
9
|
+
|
|
10
|
+
The heavy lifting (XBRL parsing, CUSIP mapping, quarter-over-quarter diffs)
|
|
11
|
+
happens server-side, so this client stays tiny and has one dependency
|
|
12
|
+
(`requests`).
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install edgrapi
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Get a free API key (100 calls/month, no card) at <https://edgrapi.com>.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from edgrapi import Client
|
|
26
|
+
|
|
27
|
+
c = Client("your_key")
|
|
28
|
+
|
|
29
|
+
# Financials — income statement, balance sheet, cash flow (normalized from XBRL)
|
|
30
|
+
c.fundamentals("AAPL")
|
|
31
|
+
c.fundamentals("AAPL", period="quarterly", limit=8)
|
|
32
|
+
c.ratios("AAPL")
|
|
33
|
+
|
|
34
|
+
# Insider trades (Form 4), scored buy vs sell
|
|
35
|
+
c.insider("NVDA")
|
|
36
|
+
|
|
37
|
+
# 8-K material events, item-coded
|
|
38
|
+
c.events("TSLA")
|
|
39
|
+
c.events("TSLA", notable=True) # skip routine 8-Ks
|
|
40
|
+
|
|
41
|
+
# 13F fund holdings, diffed against last quarter
|
|
42
|
+
c.holdings("berkshire") # famous-fund alias
|
|
43
|
+
c.holdings("burry")
|
|
44
|
+
|
|
45
|
+
# 13D / 13G activist stakes
|
|
46
|
+
c.activist("AAPL")
|
|
47
|
+
|
|
48
|
+
# Company profile + CIK, and recent filings
|
|
49
|
+
c.company("MSFT")
|
|
50
|
+
c.filings("MSFT", form="10-K")
|
|
51
|
+
|
|
52
|
+
# Extracted 10-K / 10-Q sections (business, risk factors, MD&A)
|
|
53
|
+
c.sections("AAPL")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Every method returns the parsed JSON body as a `dict`.
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
Failed calls raise `EdgrapiError`, which carries the HTTP status and the
|
|
61
|
+
server's detail:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from edgrapi import Client, EdgrapiError
|
|
65
|
+
|
|
66
|
+
c = Client("your_key")
|
|
67
|
+
try:
|
|
68
|
+
c.fundamentals("NOTATICKER")
|
|
69
|
+
except EdgrapiError as e:
|
|
70
|
+
print(e.status, e.detail) # e.g. 404 unknown ticker
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Common statuses: `401` bad key, `402` / `429` out of credits, `404` unknown
|
|
74
|
+
ticker. Calls that return no data are not charged. The exact credit cost of each
|
|
75
|
+
call comes back in the `X-Credits-Cost` response header, and your remaining
|
|
76
|
+
balance in `X-Credits-Remaining`.
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- This is a thin HTTP client. The API it talks to is a hosted service; if you'd
|
|
81
|
+
rather run everything locally with no API key, [edgartools](https://github.com/dgunning/edgartools)
|
|
82
|
+
is an excellent open-source library that parses EDGAR on your own machine.
|
|
83
|
+
- Data is public SEC EDGAR content, surfaced for research. Not investment advice.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
[MIT](LICENSE).
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""edgrapi — a tiny Python client for the Edgrapi SEC EDGAR data API.
|
|
3
|
+
|
|
4
|
+
Parsed SEC filings as clean JSON: company financials, insider trades (Form 4),
|
|
5
|
+
8-K events, 13F fund holdings, and 13D/13G activist stakes. No LLM in the data
|
|
6
|
+
path — every value is lifted straight from the filing, so you can verify any
|
|
7
|
+
number on EDGAR yourself.
|
|
8
|
+
|
|
9
|
+
Get a free API key (100 calls/month) at https://edgrapi.com.
|
|
10
|
+
|
|
11
|
+
from edgrapi import Client
|
|
12
|
+
c = Client("your_key")
|
|
13
|
+
c.fundamentals("AAPL") # income statement, balance sheet, cash flow
|
|
14
|
+
c.insider("AAPL") # Form 4 trades, scored buy vs sell
|
|
15
|
+
c.events("AAPL") # 8-K events, item-coded
|
|
16
|
+
c.holdings("berkshire") # 13F holdings, diffed vs last quarter
|
|
17
|
+
"""
|
|
18
|
+
import urllib.parse
|
|
19
|
+
|
|
20
|
+
import requests
|
|
21
|
+
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
__all__ = ["Client", "EdgrapiError"]
|
|
24
|
+
|
|
25
|
+
DEFAULT_BASE = "https://api.edgrapi.com"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EdgrapiError(Exception):
|
|
29
|
+
"""Raised when the API returns a non-2xx status. Carries the HTTP status and
|
|
30
|
+
the server's error detail so you can act on it (e.g. 401 = bad key, 402/429 =
|
|
31
|
+
out of credits, 404 = unknown ticker)."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, status, detail):
|
|
34
|
+
self.status = status
|
|
35
|
+
self.detail = detail
|
|
36
|
+
super().__init__("Edgrapi %s: %s" % (status, detail))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Client:
|
|
40
|
+
"""Client for the Edgrapi SEC-data API.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
api_key: your key from https://edgrapi.com (free tier available).
|
|
44
|
+
base_url: override the API host (defaults to https://api.edgrapi.com).
|
|
45
|
+
timeout: per-request timeout in seconds.
|
|
46
|
+
session: an existing ``requests.Session`` to reuse, if you want.
|
|
47
|
+
|
|
48
|
+
Every method returns the parsed JSON body as a dict. Failed calls raise
|
|
49
|
+
``EdgrapiError``. The exact credit cost of a call is returned by the API in
|
|
50
|
+
the ``X-Credits-Cost`` response header; the balance in ``X-Credits-Remaining``.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(self, api_key, base_url=DEFAULT_BASE, timeout=30, session=None):
|
|
54
|
+
if not api_key:
|
|
55
|
+
raise ValueError("api_key is required — get a free one at https://edgrapi.com")
|
|
56
|
+
self.api_key = api_key
|
|
57
|
+
self.base_url = base_url.rstrip("/")
|
|
58
|
+
self.timeout = timeout
|
|
59
|
+
self._s = session or requests.Session()
|
|
60
|
+
self._s.headers.update({
|
|
61
|
+
"X-API-Key": api_key,
|
|
62
|
+
"User-Agent": "edgrapi-python/%s" % __version__,
|
|
63
|
+
"Accept": "application/json",
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
# ---- internals ----
|
|
67
|
+
@staticmethod
|
|
68
|
+
def _enc(v):
|
|
69
|
+
return urllib.parse.quote(str(v).strip(), safe="")
|
|
70
|
+
|
|
71
|
+
def _get(self, path, **params):
|
|
72
|
+
params = {k: v for k, v in params.items() if v is not None}
|
|
73
|
+
resp = self._s.get(self.base_url + path, params=params, timeout=self.timeout)
|
|
74
|
+
if resp.status_code >= 400:
|
|
75
|
+
detail = resp.text
|
|
76
|
+
try:
|
|
77
|
+
body = resp.json()
|
|
78
|
+
detail = body.get("detail") or body.get("error") or detail
|
|
79
|
+
except ValueError:
|
|
80
|
+
pass
|
|
81
|
+
raise EdgrapiError(resp.status_code, detail)
|
|
82
|
+
return resp.json()
|
|
83
|
+
|
|
84
|
+
# ---- company & filings ----
|
|
85
|
+
def company(self, ticker):
|
|
86
|
+
"""Company profile and CIK for a ticker."""
|
|
87
|
+
return self._get("/v1/company/%s" % self._enc(ticker))
|
|
88
|
+
|
|
89
|
+
def filings(self, ticker, form=None, limit=None):
|
|
90
|
+
"""Recent SEC filings for a company, optionally filtered by ``form``."""
|
|
91
|
+
return self._get("/v1/filings/%s" % self._enc(ticker), form=form, limit=limit)
|
|
92
|
+
|
|
93
|
+
# ---- financials ----
|
|
94
|
+
def fundamentals(self, ticker, period=None, limit=None):
|
|
95
|
+
"""Income statement, balance sheet and cash flow, normalized from XBRL.
|
|
96
|
+
``period`` is 'annual' or 'quarterly'."""
|
|
97
|
+
return self._get("/v1/fundamentals/%s" % self._enc(ticker), period=period, limit=limit)
|
|
98
|
+
|
|
99
|
+
def ratios(self, ticker):
|
|
100
|
+
"""Computed financial ratios for a company."""
|
|
101
|
+
return self._get("/v1/ratios/%s" % self._enc(ticker))
|
|
102
|
+
|
|
103
|
+
def sections(self, ticker, form=None):
|
|
104
|
+
"""Extracted 10-K / 10-Q sections (business, risk factors, MD&A, ...)."""
|
|
105
|
+
return self._get("/v1/sections/%s" % self._enc(ticker), form=form)
|
|
106
|
+
|
|
107
|
+
# ---- insider, events & ownership ----
|
|
108
|
+
def insider(self, ticker, limit=None, form=None):
|
|
109
|
+
"""Form 4 insider transactions, scored buy vs sell (code P = open-market buy)."""
|
|
110
|
+
return self._get("/v1/insider/%s" % self._enc(ticker), limit=limit, form=form)
|
|
111
|
+
|
|
112
|
+
def events(self, ticker, limit=None, notable=None):
|
|
113
|
+
"""8-K material events with item codes; ``notable=True`` skips routine ones."""
|
|
114
|
+
return self._get("/v1/events/%s" % self._enc(ticker), limit=limit, notable=notable)
|
|
115
|
+
|
|
116
|
+
def activist(self, identifier, limit=None):
|
|
117
|
+
"""13D / 13G activist stakes for a company (ticker or CIK)."""
|
|
118
|
+
return self._get("/v1/activist/%s" % self._enc(identifier), limit=limit)
|
|
119
|
+
|
|
120
|
+
def holdings(self, identifier, limit=None, changes=None):
|
|
121
|
+
"""13F fund holdings, diffed against the prior quarter. ``identifier`` can be
|
|
122
|
+
a famous-fund alias (e.g. 'berkshire'), a manager name, or a CIK."""
|
|
123
|
+
return self._get("/v1/holdings/%s" % self._enc(identifier), limit=limit, changes=changes)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edgrapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiny Python client for the Edgrapi SEC EDGAR data API: financials, insider trades, 8-K events, 13F holdings, and 13D/13G stakes as clean JSON.
|
|
5
|
+
Author-email: Paper and Beyond <support@edgrapi.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://edgrapi.com
|
|
8
|
+
Project-URL: Documentation, https://edgrapi.com/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/paperandbeyond23-gif/edgrapi-python
|
|
10
|
+
Project-URL: Issues, https://github.com/paperandbeyond23-gif/edgrapi-python/issues
|
|
11
|
+
Keywords: sec,edgar,sec edgar,13f,insider trading,form 4,8-k,10-k,xbrl,financial data,financial statements,api
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: requests>=2.20
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# edgrapi
|
|
26
|
+
|
|
27
|
+
A tiny Python client for the [Edgrapi](https://edgrapi.com) SEC EDGAR data API.
|
|
28
|
+
|
|
29
|
+
Parsed SEC filings as clean JSON: company financials, insider trades (Form 4),
|
|
30
|
+
8-K events, 13F fund holdings, and 13D/13G activist stakes. There's **no LLM in
|
|
31
|
+
the data path** — every value is lifted straight from the filing, so you can
|
|
32
|
+
verify any number on EDGAR yourself.
|
|
33
|
+
|
|
34
|
+
The heavy lifting (XBRL parsing, CUSIP mapping, quarter-over-quarter diffs)
|
|
35
|
+
happens server-side, so this client stays tiny and has one dependency
|
|
36
|
+
(`requests`).
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install edgrapi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Get a free API key (100 calls/month, no card) at <https://edgrapi.com>.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from edgrapi import Client
|
|
50
|
+
|
|
51
|
+
c = Client("your_key")
|
|
52
|
+
|
|
53
|
+
# Financials — income statement, balance sheet, cash flow (normalized from XBRL)
|
|
54
|
+
c.fundamentals("AAPL")
|
|
55
|
+
c.fundamentals("AAPL", period="quarterly", limit=8)
|
|
56
|
+
c.ratios("AAPL")
|
|
57
|
+
|
|
58
|
+
# Insider trades (Form 4), scored buy vs sell
|
|
59
|
+
c.insider("NVDA")
|
|
60
|
+
|
|
61
|
+
# 8-K material events, item-coded
|
|
62
|
+
c.events("TSLA")
|
|
63
|
+
c.events("TSLA", notable=True) # skip routine 8-Ks
|
|
64
|
+
|
|
65
|
+
# 13F fund holdings, diffed against last quarter
|
|
66
|
+
c.holdings("berkshire") # famous-fund alias
|
|
67
|
+
c.holdings("burry")
|
|
68
|
+
|
|
69
|
+
# 13D / 13G activist stakes
|
|
70
|
+
c.activist("AAPL")
|
|
71
|
+
|
|
72
|
+
# Company profile + CIK, and recent filings
|
|
73
|
+
c.company("MSFT")
|
|
74
|
+
c.filings("MSFT", form="10-K")
|
|
75
|
+
|
|
76
|
+
# Extracted 10-K / 10-Q sections (business, risk factors, MD&A)
|
|
77
|
+
c.sections("AAPL")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Every method returns the parsed JSON body as a `dict`.
|
|
81
|
+
|
|
82
|
+
## Errors
|
|
83
|
+
|
|
84
|
+
Failed calls raise `EdgrapiError`, which carries the HTTP status and the
|
|
85
|
+
server's detail:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from edgrapi import Client, EdgrapiError
|
|
89
|
+
|
|
90
|
+
c = Client("your_key")
|
|
91
|
+
try:
|
|
92
|
+
c.fundamentals("NOTATICKER")
|
|
93
|
+
except EdgrapiError as e:
|
|
94
|
+
print(e.status, e.detail) # e.g. 404 unknown ticker
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Common statuses: `401` bad key, `402` / `429` out of credits, `404` unknown
|
|
98
|
+
ticker. Calls that return no data are not charged. The exact credit cost of each
|
|
99
|
+
call comes back in the `X-Credits-Cost` response header, and your remaining
|
|
100
|
+
balance in `X-Credits-Remaining`.
|
|
101
|
+
|
|
102
|
+
## Notes
|
|
103
|
+
|
|
104
|
+
- This is a thin HTTP client. The API it talks to is a hosted service; if you'd
|
|
105
|
+
rather run everything locally with no API key, [edgartools](https://github.com/dgunning/edgartools)
|
|
106
|
+
is an excellent open-source library that parses EDGAR on your own machine.
|
|
107
|
+
- Data is public SEC EDGAR content, surfaced for research. Not investment advice.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
[MIT](LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.20
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
edgrapi
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "edgrapi"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Tiny Python client for the Edgrapi SEC EDGAR data API: financials, insider trades, 8-K events, 13F holdings, and 13D/13G stakes as clean JSON."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Paper and Beyond", email = "support@edgrapi.com" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"sec", "edgar", "sec edgar", "13f", "insider trading", "form 4",
|
|
15
|
+
"8-k", "10-k", "xbrl", "financial data", "financial statements", "api",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Topic :: Office/Business :: Financial",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
]
|
|
26
|
+
dependencies = ["requests>=2.20"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://edgrapi.com"
|
|
30
|
+
Documentation = "https://edgrapi.com/docs"
|
|
31
|
+
Repository = "https://github.com/paperandbeyond23-gif/edgrapi-python"
|
|
32
|
+
Issues = "https://github.com/paperandbeyond23-gif/edgrapi-python/issues"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
packages = ["edgrapi"]
|
edgrapi-0.1.0/setup.cfg
ADDED