sec-daily-api 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,44 @@
1
+ """Official Python SDK for the SEC Daily API.
2
+
3
+ Real-time SEC EDGAR filings, company data, and news.
4
+ See https://www.secdailyapi.com/docs for the full reference.
5
+ """
6
+
7
+ from .client import BASE_URL, SecDailyAPI, SecDailyAPIError
8
+ from .types import (
9
+ Entity,
10
+ EntityAddress,
11
+ EntityFormerName,
12
+ Fieldset,
13
+ Filing,
14
+ FilingDocument,
15
+ FilingEntity,
16
+ FilingFiler,
17
+ FilingMarkdown,
18
+ FilingsResponse,
19
+ NewsItem,
20
+ NewsResponse,
21
+ Pagination,
22
+ )
23
+
24
+ __version__ = "0.1.0"
25
+
26
+ __all__ = [
27
+ "SecDailyAPI",
28
+ "SecDailyAPIError",
29
+ "BASE_URL",
30
+ "Filing",
31
+ "FilingsResponse",
32
+ "FilingDocument",
33
+ "FilingEntity",
34
+ "FilingFiler",
35
+ "FilingMarkdown",
36
+ "Entity",
37
+ "EntityAddress",
38
+ "EntityFormerName",
39
+ "NewsItem",
40
+ "NewsResponse",
41
+ "Pagination",
42
+ "Fieldset",
43
+ "__version__",
44
+ ]
@@ -0,0 +1,385 @@
1
+ """Synchronous client for the SEC Daily API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import re
8
+ import time
9
+ import urllib.error
10
+ import urllib.parse
11
+ import urllib.request
12
+ from typing import Any, Dict, Iterator, Optional, Sequence, Union
13
+
14
+ from .types import Entity, Fieldset, Filing, FilingsResponse, NewsItem, NewsResponse
15
+
16
+ BASE_URL = "https://api.secdailyapi.com"
17
+
18
+ _DATE_RE = re.compile(r"^\d{4}-\d{2}-\d{2}$")
19
+ _CIK_RE = re.compile(r"^\d+$")
20
+
21
+ _FILINGS_PARAM_MAP = {
22
+ "ticker": "ticker",
23
+ "cik": "cik",
24
+ "accession_number": "accessionNumber",
25
+ "form_types": "formTypes",
26
+ "filing_date": "filingDate",
27
+ "filing_date_start": "filingDateStart",
28
+ "filing_date_end": "filingDateEnd",
29
+ "limit": "limit",
30
+ "fieldset": "fieldset",
31
+ "fields": "fields",
32
+ "cursor": "cursor",
33
+ }
34
+
35
+ _NEWS_PARAM_MAP = {
36
+ "news_type": "newsType",
37
+ "start_date": "startDate",
38
+ "end_date": "endDate",
39
+ "limit": "limit",
40
+ "fieldset": "fieldset",
41
+ }
42
+
43
+ StrOrSeq = Union[str, Sequence[str]]
44
+
45
+
46
+ class SecDailyAPIError(Exception):
47
+ """Raised when the API returns a non-success status code.
48
+
49
+ The HTTP status (when available) is exposed as ``.status``.
50
+ """
51
+
52
+ def __init__(self, message: str, status: Optional[int] = None) -> None:
53
+ super().__init__(message)
54
+ self.status = status
55
+
56
+
57
+ def _assert_date(value: Optional[str], name: str) -> None:
58
+ if value is not None and not _DATE_RE.match(value):
59
+ raise ValueError(
60
+ f"SecDailyAPI: invalid date format for '{name}': '{value}'. "
61
+ "Expected YYYY-MM-DD."
62
+ )
63
+
64
+
65
+ def _assert_cik(value: Optional[str]) -> None:
66
+ if value is not None and not _CIK_RE.match(value):
67
+ raise ValueError(
68
+ f"SecDailyAPI: invalid cik: '{value}'. CIK must be numeric."
69
+ )
70
+
71
+
72
+ class SecDailyAPI:
73
+ """Client for the SEC Daily API.
74
+
75
+ Args:
76
+ api_key: Your API key. Falls back to the ``SEC_DAILY_API_KEY``
77
+ environment variable when omitted.
78
+ timeout: Per-request socket timeout in seconds (default 30).
79
+ """
80
+
81
+ def __init__(
82
+ self,
83
+ api_key: Optional[str] = None,
84
+ *,
85
+ timeout: float = 30.0,
86
+ ) -> None:
87
+ api_key = api_key or os.environ.get("SEC_DAILY_API_KEY", "")
88
+ if not api_key:
89
+ raise ValueError(
90
+ "SecDailyAPI: api_key is required. Set the "
91
+ "SEC_DAILY_API_KEY env var or pass api_key."
92
+ )
93
+ self._api_key = api_key
94
+ self._timeout = timeout
95
+
96
+ def _build_url(self, path: str, params: Optional[Dict[str, Any]] = None) -> str:
97
+ url = f"{BASE_URL}{path}"
98
+ if params:
99
+ pairs = []
100
+ for key, value in params.items():
101
+ if value is None:
102
+ continue
103
+ if isinstance(value, (list, tuple)):
104
+ pairs.append((key, ",".join(str(v) for v in value)))
105
+ elif isinstance(value, bool):
106
+ pairs.append((key, "true" if value else "false"))
107
+ else:
108
+ pairs.append((key, str(value)))
109
+ if pairs:
110
+ url = f"{url}?{urllib.parse.urlencode(pairs)}"
111
+ return url
112
+
113
+ def _request(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:
114
+ url = self._build_url(path, params)
115
+ request = urllib.request.Request(
116
+ url, method="GET", headers={"x-api-key": self._api_key}
117
+ )
118
+
119
+ for attempt in range(3):
120
+ try:
121
+ with urllib.request.urlopen(request, timeout=self._timeout) as resp:
122
+ return json.loads(resp.read().decode("utf-8"))
123
+ except urllib.error.HTTPError as err:
124
+ status = err.code
125
+
126
+ if status == 429:
127
+ if attempt == 2:
128
+ raise SecDailyAPIError(
129
+ "SecDaily API error 429: rate limit exceeded", 429
130
+ ) from None
131
+ retry_after = _parse_retry_after(err.headers.get("Retry-After"))
132
+ delay = retry_after if retry_after > 0 else (attempt + 1)
133
+ time.sleep(delay)
134
+ continue
135
+
136
+ if status == 504:
137
+ if attempt == 2:
138
+ raise SecDailyAPIError(
139
+ "SecDaily API error 504: request timed out", 504
140
+ ) from None
141
+ time.sleep(attempt + 1)
142
+ continue
143
+
144
+ if status == 404:
145
+ raise SecDailyAPIError(
146
+ f"SecDaily API error 404: not found", 404
147
+ ) from None
148
+
149
+ raise SecDailyAPIError(
150
+ f"SecDaily API error {status}: {_extract_message(err)}",
151
+ status,
152
+ ) from None
153
+ except urllib.error.URLError as err:
154
+ raise SecDailyAPIError(
155
+ f"SecDaily API request failed: {err.reason}"
156
+ ) from None
157
+
158
+ raise SecDailyAPIError("SecDaily API error: max retries exceeded")
159
+
160
+ def get_filings(
161
+ self,
162
+ *,
163
+ ticker: Optional[str] = None,
164
+ cik: Optional[str] = None,
165
+ accession_number: Optional[str] = None,
166
+ form_types: Optional[StrOrSeq] = None,
167
+ filing_date: Optional[str] = None,
168
+ filing_date_start: Optional[str] = None,
169
+ filing_date_end: Optional[str] = None,
170
+ limit: Optional[int] = None,
171
+ fieldset: Optional[Fieldset] = None,
172
+ fields: Optional[StrOrSeq] = None,
173
+ cursor: Optional[str] = None,
174
+ ) -> FilingsResponse:
175
+ """Search and filter SEC EDGAR filings.
176
+
177
+ All arguments are keyword-only and optional. Date strings must be
178
+ ``YYYY-MM-DD``; CIKs must be numeric.
179
+
180
+ Returns a dict with ``filings`` (list), ``count`` (int), and
181
+ ``pagination`` (dict with ``hasMore`` and optional ``nextCursor``).
182
+
183
+ Raises:
184
+ ValueError: for client-side validation failures.
185
+ SecDailyAPIError: for non-success HTTP responses.
186
+ """
187
+ _assert_date(filing_date, "filing_date")
188
+ _assert_date(filing_date_start, "filing_date_start")
189
+ _assert_date(filing_date_end, "filing_date_end")
190
+ _assert_cik(cik)
191
+
192
+ if filing_date_start and filing_date_end and filing_date_start > filing_date_end:
193
+ raise ValueError(
194
+ f"SecDailyAPI: filing_date_start '{filing_date_start}' must not be "
195
+ f"after filing_date_end '{filing_date_end}'."
196
+ )
197
+
198
+ local = locals()
199
+ params = {
200
+ api_key: local[py_key]
201
+ for py_key, api_key in _FILINGS_PARAM_MAP.items()
202
+ if local[py_key] is not None
203
+ }
204
+ raw = self._request("/filings", params)
205
+ return {
206
+ "filings": raw.get("filings", []),
207
+ "count": raw.get("count", 0),
208
+ "pagination": {
209
+ "hasMore": raw.get("hasMore", False),
210
+ **({"nextCursor": raw["nextCursor"]} if raw.get("nextCursor") else {}),
211
+ },
212
+ }
213
+
214
+ def iter_filings(
215
+ self,
216
+ *,
217
+ ticker: Optional[str] = None,
218
+ cik: Optional[str] = None,
219
+ accession_number: Optional[str] = None,
220
+ form_types: Optional[StrOrSeq] = None,
221
+ filing_date: Optional[str] = None,
222
+ filing_date_start: Optional[str] = None,
223
+ filing_date_end: Optional[str] = None,
224
+ limit: Optional[int] = None,
225
+ fieldset: Optional[Fieldset] = None,
226
+ fields: Optional[StrOrSeq] = None,
227
+ ) -> Iterator[Filing]:
228
+ """Yield filings across all pages, following ``nextCursor``.
229
+
230
+ Accepts the same filters as :meth:`get_filings` (cursor is managed
231
+ internally). Each page is a separate request against your quota — use
232
+ a larger ``limit`` (up to 1000) on big walks to minimize requests.
233
+
234
+ Example::
235
+
236
+ for filing in client.iter_filings(
237
+ ticker="AAPL",
238
+ form_types="10-K",
239
+ ):
240
+ print(filing["id"], filing["filingDateInEst"])
241
+ """
242
+ filters = {k: v for k, v in locals().items() if k != "self"}
243
+ cursor: Optional[str] = None
244
+ while True:
245
+ response = self.get_filings(cursor=cursor, **filters)
246
+ for filing in response.get("filings", []):
247
+ yield filing
248
+ pagination = response.get("pagination", {})
249
+ if not pagination.get("hasMore"):
250
+ break
251
+ cursor = pagination.get("nextCursor")
252
+ if not cursor:
253
+ break
254
+
255
+ def get_filing(self, id: str) -> Optional[Filing]:
256
+ """Fetch a single filing by its internal ID.
257
+
258
+ Returns ``None`` if no filing with that ID exists.
259
+
260
+ Raises:
261
+ SecDailyAPIError: for non-404 HTTP errors.
262
+ """
263
+ if not id:
264
+ raise ValueError("get_filing: 'id' is required")
265
+ try:
266
+ data = self._request(f"/filings/{urllib.parse.quote(id, safe='')}")
267
+ return data.get("filing")
268
+ except SecDailyAPIError as err:
269
+ if err.status == 404:
270
+ return None
271
+ raise
272
+
273
+ def get_filing_by_accession(self, accession_number: str) -> Optional[Filing]:
274
+ """Fetch a single filing by its SEC accession number.
275
+
276
+ Returns ``None`` if not found.
277
+
278
+ Raises:
279
+ SecDailyAPIError: for non-success HTTP errors.
280
+ """
281
+ if not accession_number:
282
+ raise ValueError("get_filing_by_accession: 'accession_number' is required")
283
+ response = self.get_filings(accession_number=accession_number)
284
+ filings = response.get("filings", [])
285
+ return filings[0] if filings else None
286
+
287
+ def get_entity(
288
+ self,
289
+ *,
290
+ ticker: Optional[str] = None,
291
+ cik: Optional[str] = None,
292
+ ) -> Optional[Entity]:
293
+ """Look up a company by ticker or CIK.
294
+
295
+ Exactly one of ``ticker`` or ``cik`` must be provided.
296
+ Returns ``None`` if not found.
297
+
298
+ Raises:
299
+ ValueError: if neither or both of ``ticker``/``cik`` are provided.
300
+ SecDailyAPIError: for non-success HTTP errors.
301
+ """
302
+ if not ticker and not cik:
303
+ raise ValueError("get_entity requires either 'ticker' or 'cik'")
304
+ if ticker and cik:
305
+ raise ValueError("get_entity requires either 'ticker' or 'cik', not both")
306
+
307
+ if cik:
308
+ _assert_cik(cik)
309
+ try:
310
+ data = self._request(f"/entities/{urllib.parse.quote(cik, safe='')}")
311
+ return data.get("entity")
312
+ except SecDailyAPIError as err:
313
+ if err.status == 404:
314
+ return None
315
+ raise
316
+ else:
317
+ data = self._request("/entities", {"ticker": ticker.upper()}) # type: ignore[union-attr]
318
+ entities = data.get("entities", [])
319
+ return entities[0] if entities else None
320
+
321
+ def get_news(
322
+ self,
323
+ *,
324
+ news_type: Optional[str] = None,
325
+ start_date: Optional[str] = None,
326
+ end_date: Optional[str] = None,
327
+ limit: Optional[int] = None,
328
+ fieldset: Optional[Fieldset] = None,
329
+ ) -> NewsResponse:
330
+ """Retrieve SEC press releases and market news.
331
+
332
+ All arguments are keyword-only and optional.
333
+
334
+ Returns a dict with ``news`` (list) and ``count`` (int).
335
+
336
+ Raises:
337
+ SecDailyAPIError: for non-success HTTP responses.
338
+ """
339
+ _assert_date(start_date, "start_date")
340
+ _assert_date(end_date, "end_date")
341
+
342
+ local = locals()
343
+ params = {
344
+ api_key: local[py_key]
345
+ for py_key, api_key in _NEWS_PARAM_MAP.items()
346
+ if local[py_key] is not None
347
+ }
348
+ return self._request("/news", params)
349
+
350
+ def get_news_item(self, id: str) -> Optional[NewsItem]:
351
+ """Fetch a single news item by its ID.
352
+
353
+ Returns ``None`` if not found.
354
+
355
+ Raises:
356
+ SecDailyAPIError: for non-404 HTTP errors.
357
+ """
358
+ if not id:
359
+ raise ValueError("get_news_item: 'id' is required")
360
+ try:
361
+ data = self._request(f"/news/{urllib.parse.quote(id, safe='')}")
362
+ return data.get("newsItem")
363
+ except SecDailyAPIError as err:
364
+ if err.status == 404:
365
+ return None
366
+ raise
367
+
368
+
369
+ def _parse_retry_after(value: Optional[str]) -> float:
370
+ try:
371
+ return float(value) if value else 0.0
372
+ except (TypeError, ValueError):
373
+ return 0.0
374
+
375
+
376
+ def _extract_message(err: "urllib.error.HTTPError") -> str:
377
+ try:
378
+ text = err.read().decode("utf-8")
379
+ except Exception:
380
+ return err.reason or ""
381
+ try:
382
+ body = json.loads(text)
383
+ return body.get("error") or body.get("message") or body.get("Message") or text
384
+ except (ValueError, AttributeError):
385
+ return text
sec_daily_api/py.typed ADDED
File without changes
sec_daily_api/types.py ADDED
@@ -0,0 +1,168 @@
1
+ """Type definitions for the SEC Daily API.
2
+
3
+ Response objects are returned as plain ``dict`` values (the decoded JSON).
4
+ The ``TypedDict`` classes below describe their shape for editors and type
5
+ checkers; they are not enforced at runtime. Every field is optional unless
6
+ noted, mirroring the sparse nature of the API responses.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from typing import Any, Dict, List, Literal, TypedDict
12
+
13
+ # ---------------------------------------------------------------------------
14
+ # Entity types
15
+ # ---------------------------------------------------------------------------
16
+
17
+
18
+ class EntityAddress(TypedDict, total=False):
19
+ street1: str
20
+ street2: str
21
+ city: str
22
+ stateOrCountry: str
23
+ stateOrCountryDescription: str
24
+ zipCode: str
25
+
26
+
27
+ class EntityFormerName(TypedDict, total=False):
28
+ name: str
29
+ # ISO date strings
30
+ from_: str
31
+ to: str
32
+
33
+
34
+ class Entity(TypedDict, total=False):
35
+ cik: str
36
+ name: str
37
+ ticker: str
38
+ exchange: str
39
+ entityType: str
40
+ category: str
41
+ sicCode: str
42
+ sicDescription: str
43
+ stateOfIncorporation: str
44
+ fiscalYearEnd: str
45
+ irsNumber: str
46
+ lei: str
47
+ phone: str
48
+ website: str
49
+ investorWebsite: str
50
+ businessAddress: EntityAddress
51
+ mailAddress: EntityAddress
52
+ formerNames: List[EntityFormerName]
53
+ formerTickers: List[str]
54
+
55
+
56
+ # ---------------------------------------------------------------------------
57
+ # Filing types
58
+ # ---------------------------------------------------------------------------
59
+
60
+
61
+ class FilingDocument(TypedDict, total=False):
62
+ description: str
63
+ type: str
64
+ size: str
65
+ seq: str
66
+ url: str
67
+
68
+
69
+ class FilingFiler(TypedDict, total=False):
70
+ cik: str
71
+ name: str
72
+ role: str
73
+
74
+
75
+ class FilingEntity(TypedDict, total=False):
76
+ cik: str
77
+ name: str
78
+ ticker: str
79
+ exchange: str
80
+ sicCode: str
81
+ stateOfIncorporation: str
82
+ fiscalYearEnd: str
83
+
84
+
85
+ class FilingMarkdown(TypedDict, total=False):
86
+ id: str
87
+ formType: str
88
+ content: str
89
+ wordCount: int
90
+ charCount: int
91
+ variant: str
92
+ snippet: str
93
+
94
+
95
+ class Filing(TypedDict, total=False):
96
+ id: str
97
+ cik: str
98
+ accessionNumber: str
99
+ formType: str
100
+ filingDateInEst: str
101
+ filingDateInUtc: str
102
+ filingTimeInEst: str
103
+ filingTimeInUtc: str
104
+ filingMonth: str
105
+ periodOfReport: str
106
+ items: str
107
+ publicDocumentCount: int
108
+ acceptanceDateTimeInEst: str
109
+ acceptanceDateTimeInUtc: str
110
+ linkToFilingDetail: str
111
+ linkToPrimaryDocument: str
112
+ linkToSubmissionTxt: str
113
+ linkToFiling: str # deprecated: use linkToFilingDetail
114
+ linkToTxt: str # deprecated: use linkToSubmissionTxt
115
+ linksToDocuments: List[str] # deprecated
116
+ documentFormatFiles: List[FilingDocument]
117
+ dataFiles: List[FilingDocument]
118
+ filers: List[FilingFiler]
119
+ entity: FilingEntity
120
+ markdown: FilingMarkdown
121
+ summary: str
122
+
123
+
124
+ # ---------------------------------------------------------------------------
125
+ # News types
126
+ # ---------------------------------------------------------------------------
127
+
128
+
129
+ class NewsItem(TypedDict, total=False):
130
+ id: str
131
+ newsType: str
132
+ date: str
133
+
134
+
135
+ # ---------------------------------------------------------------------------
136
+ # Pagination
137
+ # ---------------------------------------------------------------------------
138
+
139
+
140
+ class Pagination(TypedDict, total=False):
141
+ hasMore: bool
142
+ nextCursor: str
143
+
144
+
145
+ # ---------------------------------------------------------------------------
146
+ # Query param literals
147
+ # ---------------------------------------------------------------------------
148
+
149
+ Fieldset = Literal["minimal", "standard", "full"]
150
+
151
+ # ---------------------------------------------------------------------------
152
+ # Response types
153
+ # ---------------------------------------------------------------------------
154
+
155
+
156
+ class FilingsResponse(TypedDict):
157
+ filings: List[Filing]
158
+ count: int
159
+ pagination: Pagination
160
+
161
+
162
+ class NewsResponse(TypedDict):
163
+ news: List[NewsItem]
164
+ count: int
165
+
166
+
167
+ class EntityResponse(TypedDict, total=False):
168
+ entity: Entity
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: sec-daily-api
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the SEC Daily API — real-time SEC EDGAR filings, company data, and news.
5
+ Project-URL: Homepage, https://www.secdailyapi.com
6
+ Project-URL: Documentation, https://www.secdailyapi.com/docs
7
+ Project-URL: Pricing, https://www.secdailyapi.com/pricing
8
+ Author: GoodTech LLC
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: 10-k,10-q,13f,8-k,api-client,edgar,filings,financial-data,fintech,form-4,insider-trading,quantitative-finance,sec
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Office/Business :: Financial :: Investment
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+
29
+ # SEC Daily API — Python SDK
30
+
31
+ Official Python SDK for the [SEC Daily API](https://www.secdailyapi.com) — real-time SEC EDGAR filings, company data, and news.
32
+
33
+ > **Using Claude, Cursor, ChatGPT, or another AI assistant?** Use the [sec-daily-mcp](https://www.npmjs.com/package/sec-daily-mcp) package instead — it connects your AI tool directly to the SEC Daily API with no code required.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install sec-daily-api
39
+ ```
40
+
41
+ Requires Python 3.8+. No runtime dependencies.
42
+
43
+ ## Quick Start
44
+
45
+ ```python
46
+ import os
47
+ from sec_daily_api import SecDailyAPI
48
+
49
+ client = SecDailyAPI(api_key=os.environ["SEC_DAILY_API_KEY"])
50
+
51
+ # Get Apple's latest 10-K filings
52
+ result = client.get_filings(ticker="AAPL", form_types="10-K", limit=5)
53
+
54
+ for filing in result["filings"]:
55
+ print(filing["filingDateInEst"], filing["formType"], filing.get("summary", ""))
56
+ ```
57
+
58
+ Get your API key at [secdailyapi.com](https://www.secdailyapi.com).
59
+
60
+ ---
61
+
62
+ ## API Reference
63
+
64
+ For the full reference including all parameters, response schemas, and plan limits, see [secdailyapi.com/docs](https://www.secdailyapi.com/docs).
65
+
66
+ ### `SecDailyAPI(api_key=None, *, timeout=30.0)`
67
+
68
+ | Argument | Type | Description |
69
+ |---|---|---|
70
+ | `api_key` | `str` | Your API key. Defaults to `SEC_DAILY_API_KEY` env var |
71
+ | `timeout` | `float` | Per-request socket timeout in seconds (default 30) |
72
+
73
+ ---
74
+
75
+ ### `get_filings(**params)`
76
+
77
+ Search and filter SEC EDGAR filings.
78
+
79
+ ```python
80
+ result = client.get_filings(
81
+ ticker="AAPL",
82
+ form_types=["10-K", "10-Q"],
83
+ filing_date_start="2025-01-01",
84
+ filing_date_end="2025-12-31",
85
+ limit=50,
86
+ )
87
+ for filing in result["filings"]:
88
+ print(filing["formType"], filing["filingDateInEst"])
89
+ ```
90
+
91
+ | Parameter | Type | Description |
92
+ |---|---|---|
93
+ | `ticker` | `str` | Company ticker, e.g. `"AAPL"` |
94
+ | `cik` | `str` | Company CIK (numeric) |
95
+ | `accession_number` | `str` | Exact SEC accession number |
96
+ | `form_types` | `str \| list[str]` | e.g. `"10-K"`, `["10-K","10-Q"]`, `"8-K"`, `"4"` |
97
+ | `filing_date` | `str` | Exact filing date `YYYY-MM-DD` |
98
+ | `filing_date_start` | `str` | Date range start `YYYY-MM-DD` |
99
+ | `filing_date_end` | `str` | Date range end `YYYY-MM-DD` |
100
+ | `fieldset` | `"minimal" \| "standard" \| "full"` | Response size control |
101
+ | `limit` | `int` | Results per page, default 200, max 1000 |
102
+ | `cursor` | `str` | Pagination cursor from a previous response |
103
+
104
+ **Response:** dict with `filings` (list), `count` (int), `pagination` (dict with `hasMore` and optional `nextCursor`).
105
+
106
+ ---
107
+
108
+ ### `iter_filings(**params)`
109
+
110
+ Auto-paginating generator that yields individual filings across all pages.
111
+
112
+ ```python
113
+ # Walk all of Apple's 10-K filings without managing cursors yourself
114
+ for filing in client.iter_filings(ticker="AAPL", form_types="10-K", limit=1000):
115
+ print(filing["id"], filing["filingDateInEst"])
116
+ ```
117
+
118
+ Accepts the same filters as `get_filings`. Each page counts against your quota — use a larger `limit` to minimize requests.
119
+
120
+ ---
121
+
122
+ ### `get_filing(id)`
123
+
124
+ Fetch a single filing by its internal ID. Returns `None` if not found.
125
+
126
+ ```python
127
+ filing = client.get_filing("abc123...")
128
+ ```
129
+
130
+ ---
131
+
132
+ ### `get_filing_by_accession(accession_number)`
133
+
134
+ Fetch a single filing by its SEC accession number. Returns `None` if not found.
135
+
136
+ ```python
137
+ filing = client.get_filing_by_accession("0001193125-24-012345")
138
+ ```
139
+
140
+ ---
141
+
142
+ ### `get_entity(*, ticker=None, cik=None)`
143
+
144
+ Look up a company's SEC profile. Provide either `ticker` or `cik`.
145
+
146
+ ```python
147
+ entity = client.get_entity(ticker="AAPL")
148
+ print(entity["name"], entity["cik"], entity["sicDescription"])
149
+ ```
150
+
151
+ Returns a dict with: `cik`, `name`, `ticker`, `exchange`, `sicCode`, `sicDescription`, `stateOfIncorporation`, `fiscalYearEnd`, `businessAddress`, `website`, `formerNames`, and more. Returns `None` if not found.
152
+
153
+ ---
154
+
155
+ ### `get_news(**params)`
156
+
157
+ Retrieve SEC press releases and market news.
158
+
159
+ ```python
160
+ result = client.get_news(
161
+ news_type="PressReleases",
162
+ start_date="2026-01-01",
163
+ end_date="2026-01-31",
164
+ limit=40,
165
+ )
166
+ for item in result["news"]:
167
+ print(item["date"], item["newsType"])
168
+ ```
169
+
170
+ | Parameter | Type | Description |
171
+ |---|---|---|
172
+ | `news_type` | `str` | News category (default: `"PressReleases"`) |
173
+ | `start_date` | `str` | Date range start `YYYY-MM-DD` |
174
+ | `end_date` | `str` | Date range end `YYYY-MM-DD` |
175
+ | `limit` | `int` | Results, default 40, max 100 |
176
+
177
+ ---
178
+
179
+ ### `get_news_item(id)`
180
+
181
+ Fetch a single news item by ID. Returns `None` if not found.
182
+
183
+ ---
184
+
185
+ ## TypeScript / type checking
186
+
187
+ Full type stubs are included. All response shapes are described as `TypedDict` classes.
188
+
189
+ ```python
190
+ from sec_daily_api import Filing, Entity, NewsItem, FilingsResponse
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Error handling
196
+
197
+ ```python
198
+ from sec_daily_api import SecDailyAPI, SecDailyAPIError
199
+
200
+ try:
201
+ result = client.get_filings(ticker="AAPL")
202
+ except SecDailyAPIError as err:
203
+ print(err.status, err) # e.g. 403, "SecDaily API error 403: Forbidden"
204
+ ```
205
+
206
+ | Status | Meaning |
207
+ |---|---|
208
+ | 400 | Invalid parameters |
209
+ | 403 | Invalid or missing API key |
210
+ | 429 | Rate limit exceeded — retried automatically up to 3 times |
211
+ | 504 | Request timed out — retried automatically up to 3 times |
212
+ | 500 | Server error |
213
+
214
+ ---
215
+
216
+ ## Resources
217
+
218
+ - Docs: [secdailyapi.com/docs](https://www.secdailyapi.com/docs)
219
+ - Pricing: [secdailyapi.com/pricing](https://www.secdailyapi.com/pricing)
220
+ - Dashboard: [secdailyapi.com/dashboard](https://www.secdailyapi.com/dashboard)
221
+ - Node.js SDK: [sec-daily-api on npm](https://www.npmjs.com/package/sec-daily-api)
222
+ - MCP Server: [sec-daily-mcp on npm](https://www.npmjs.com/package/sec-daily-mcp)
223
+
224
+ ---
225
+
226
+ ## Legal disclaimer
227
+
228
+ The data provided through this SDK is for **informational purposes only** and does not constitute investment advice, financial advice, trading advice, or any other type of advice. GoodTech LLC makes no representations as to the accuracy, completeness, or timeliness of the data. You are solely responsible for your use of the data. Always consult a qualified financial professional before making investment decisions.
229
+
230
+ ---
231
+
232
+ Licensed under the [Apache 2.0 License](./LICENSE). Copyright 2026 GoodTech LLC.
@@ -0,0 +1,8 @@
1
+ sec_daily_api/__init__.py,sha256=-VnWU3KRLVy3iWXc1FBfdMOX3PzKr3KJIWQbzeFffRw,837
2
+ sec_daily_api/client.py,sha256=C9TrKaS-TqJ2-FdQeZya_JmNfKk7k3wyD34Rdkcvvdg,13010
3
+ sec_daily_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ sec_daily_api/types.py,sha256=GJpeSp9iTUNgKDx6GSQryAvv30A9Q7UHr79BAM5fJbU,4019
5
+ sec_daily_api-0.1.0.dist-info/METADATA,sha256=IDtj-FeUsY3tYAILlD3TF2R6pLxjLkE8Xp8YpBV3cBw,7399
6
+ sec_daily_api-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
7
+ sec_daily_api-0.1.0.dist-info/licenses/LICENSE,sha256=lADtMYyjqkEu2le7C094P4pU7Eaj4ne8-km29hEs_x8,10010
8
+ sec_daily_api-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,180 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or
82
+ contributory patent infringement, then any patent licenses granted to
83
+ You under this License for that Work shall terminate as of the date
84
+ such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the
121
+ Derivative Works, and to permit persons to whom the Derivative
122
+ Works is furnished to do so, subject to the following conditions:
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Additional Liability. While redistributing
160
+ the Work or Derivative Works thereof, You may choose to offer,
161
+ and charge a fee for, acceptance of support, warranty, indemnity,
162
+ or other liability obligations and/or rights consistent with this
163
+ License. However, in accepting such obligations, You may offer only
164
+ conditions consistent with this License.
165
+
166
+ END OF TERMS AND CONDITIONS
167
+
168
+ Copyright 2026 GoodTech LLC
169
+
170
+ Licensed under the Apache License, Version 2.0 (the "License");
171
+ you may not use this file except in compliance with the License.
172
+ You may obtain a copy of the License at
173
+
174
+ http://www.apache.org/licenses/LICENSE-2.0
175
+
176
+ Unless required by applicable law or agreed to in writing, software
177
+ distributed under the License is distributed on an "AS IS" BASIS,
178
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
+ See the License for the specific language governing permissions and
180
+ limitations under the License.