secblast 0.1.8__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.
Files changed (48) hide show
  1. secblast-0.1.8/Dockerfile +12 -0
  2. secblast-0.1.8/LICENSE +21 -0
  3. secblast-0.1.8/PKG-INFO +234 -0
  4. secblast-0.1.8/README.md +197 -0
  5. secblast-0.1.8/pyproject.toml +85 -0
  6. secblast-0.1.8/rate_capacity_test.py +494 -0
  7. secblast-0.1.8/secblast/__init__.py +117 -0
  8. secblast-0.1.8/secblast/async_client.py +622 -0
  9. secblast-0.1.8/secblast/client.py +188 -0
  10. secblast-0.1.8/secblast/endpoints/__init__.py +15 -0
  11. secblast-0.1.8/secblast/endpoints/documents.py +123 -0
  12. secblast-0.1.8/secblast/endpoints/entities.py +117 -0
  13. secblast-0.1.8/secblast/endpoints/filings.py +186 -0
  14. secblast-0.1.8/secblast/endpoints/financials.py +337 -0
  15. secblast-0.1.8/secblast/endpoints/search.py +108 -0
  16. secblast-0.1.8/secblast/exceptions.py +52 -0
  17. secblast-0.1.8/secblast/models/__init__.py +60 -0
  18. secblast-0.1.8/secblast/models/entity.py +46 -0
  19. secblast-0.1.8/secblast/models/filing.py +100 -0
  20. secblast-0.1.8/secblast/models/financials.py +275 -0
  21. secblast-0.1.8/secblast/models/search.py +39 -0
  22. secblast-0.1.8/secblast/py.typed +0 -0
  23. secblast-0.1.8/xbrl_service/Dockerfile +23 -0
  24. secblast-0.1.8/xbrl_service/FINANCIAL_TABLE_RENDERING.md +256 -0
  25. secblast-0.1.8/xbrl_service/GO_INTEGRATION.md +289 -0
  26. secblast-0.1.8/xbrl_service/openapi.yaml +812 -0
  27. secblast-0.1.8/xbrl_service/requirements.txt +14 -0
  28. secblast-0.1.8/xbrl_service/src/__init__.py +0 -0
  29. secblast-0.1.8/xbrl_service/src/api/__init__.py +0 -0
  30. secblast-0.1.8/xbrl_service/src/api/endpoints/__init__.py +0 -0
  31. secblast-0.1.8/xbrl_service/src/api/endpoints/financials.py +959 -0
  32. secblast-0.1.8/xbrl_service/src/api/endpoints/financials_v2.py +205 -0
  33. secblast-0.1.8/xbrl_service/src/bulk_processor.py +697 -0
  34. secblast-0.1.8/xbrl_service/src/config.py +38 -0
  35. secblast-0.1.8/xbrl_service/src/main.py +114 -0
  36. secblast-0.1.8/xbrl_service/src/models/__init__.py +16 -0
  37. secblast-0.1.8/xbrl_service/src/models/database.py +92 -0
  38. secblast-0.1.8/xbrl_service/src/models/schemas.py +199 -0
  39. secblast-0.1.8/xbrl_service/src/services/__init__.py +13 -0
  40. secblast-0.1.8/xbrl_service/src/services/cache_service.py +38 -0
  41. secblast-0.1.8/xbrl_service/src/services/excel_export.py +421 -0
  42. secblast-0.1.8/xbrl_service/src/services/financial_extractor.py +638 -0
  43. secblast-0.1.8/xbrl_service/src/services/financial_extractor_v2.py +537 -0
  44. secblast-0.1.8/xbrl_service/src/services/gaap_mappings.py +191 -0
  45. secblast-0.1.8/xbrl_service/src/services/xbrl_parser.py +699 -0
  46. secblast-0.1.8/xbrl_service/tests/test_amd.py +154 -0
  47. secblast-0.1.8/xbrl_service/tests/test_amd_readonly.py +125 -0
  48. secblast-0.1.8/xbrl_service/tests/test_new_xbrl_schema.py +698 -0
@@ -0,0 +1,12 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ COPY pyproject.toml README.md ./
7
+ COPY secblast/ ./secblast/
8
+
9
+ RUN pip install --no-cache-dir -e ".[dev]"
10
+
11
+ # Default command - run Python shell
12
+ CMD ["python"]
secblast-0.1.8/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SecBlast
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.
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: secblast
3
+ Version: 0.1.8
4
+ Summary: Python SDK for the SecBlast SEC Filing API
5
+ Project-URL: Homepage, https://secblastapi.com
6
+ Project-URL: Documentation, https://docs.secblastapi.com
7
+ Project-URL: Repository, https://github.com/secblast/secblast-python
8
+ Author-email: SEC Blast <support@secblast.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,edgar,filings,financial,sdk,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 :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Office/Business :: Financial
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Requires-Dist: eval-type-backport>=0.2.0; python_version < '3.10'
28
+ Requires-Dist: httpx>=0.25.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
33
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
34
+ Requires-Dist: respx>=0.20.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # SecBlast Python SDK
39
+
40
+ Python SDK for the [SecBlast SEC Filing API](https://secblastapi.com).
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install secblast
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ```python
51
+ from secblast import SecBlastClient
52
+
53
+ # Initialize the client
54
+ client = SecBlastClient(api_key="your-api-key")
55
+
56
+ # Look up a company
57
+ entity = client.get_entity(ticker="AAPL")
58
+ print(f"{entity.name} (CIK: {entity.cik})")
59
+
60
+ # Search filings
61
+ filings = client.lookup_filings(
62
+ tickers=["AAPL"],
63
+ form_types=["10-K"],
64
+ date_from="2023-01-01",
65
+ )
66
+ print(f"Found {filings.count} filings")
67
+
68
+ # Full-text search
69
+ results = client.fulltext_search(
70
+ "material contract",
71
+ form_types=["8-K"],
72
+ )
73
+ for hit in results.hits:
74
+ print(f"{hit.accession_number}: {hit.text_content[:100]}...")
75
+
76
+ # Get financial data
77
+ balance_sheet = client.get_balance_sheet(cik="320193")
78
+ ```
79
+
80
+ ## Async Support
81
+
82
+ ```python
83
+ import asyncio
84
+ from secblast import AsyncSecBlastClient
85
+
86
+ async def main():
87
+ async with AsyncSecBlastClient(api_key="your-api-key") as client:
88
+ entity = await client.get_entity(ticker="AAPL")
89
+ print(entity.name)
90
+
91
+ asyncio.run(main())
92
+ ```
93
+
94
+ ## API Reference
95
+
96
+ ### Entity Lookup
97
+
98
+ ```python
99
+ # Search entities with filters
100
+ entities = client.lookup_entities(
101
+ tickers=["AAPL", "MSFT"],
102
+ exchanges=["NASDAQ"],
103
+ sics=["3571"], # Electronic Computers
104
+ name_includes=["tech"],
105
+ )
106
+
107
+ # Get single entity
108
+ entity = client.get_entity(ticker="AAPL")
109
+ entity = client.get_entity(cik="320193")
110
+ ```
111
+
112
+ ### Filing Lookup
113
+
114
+ ```python
115
+ # Search filings
116
+ filings = client.lookup_filings(
117
+ tickers=["AAPL"],
118
+ form_types=["10-K", "10-Q"],
119
+ date_from="2023-01-01",
120
+ date_to="2023-12-31",
121
+ exclude_amendments=True,
122
+ sort_by="filing_date",
123
+ sort_order="desc",
124
+ )
125
+
126
+ # Get detailed filing info
127
+ detail = client.get_filing_info("0000320193-23-000077")
128
+ print(detail.filing.form_type)
129
+ print(len(detail.documents))
130
+
131
+ # Get 10-K/10-Q sections
132
+ sections = client.get_filing_sections(document_id, form_type="10-K")
133
+ for section in sections:
134
+ print(f"{section.id}: {section.name}")
135
+
136
+ # Batch fetch 8-K items
137
+ items = client.get_8k_items([
138
+ "0001829126-25-010357",
139
+ "0001213900-25-126699",
140
+ ])
141
+ ```
142
+
143
+ ### Full-Text Search
144
+
145
+ ```python
146
+ # Standard search
147
+ results = client.fulltext_search("revenue growth")
148
+
149
+ # Exact phrase
150
+ results = client.fulltext_search(
151
+ "material contract",
152
+ query_type="match_phrase",
153
+ )
154
+
155
+ # Lucene query syntax
156
+ results = client.fulltext_search(
157
+ "revenue AND NOT loss",
158
+ query_type="query_string",
159
+ )
160
+
161
+ # With filters
162
+ results = client.fulltext_search(
163
+ "merger agreement",
164
+ ciks=["320193"],
165
+ form_types=["8-K"],
166
+ date_from="2023-01-01",
167
+ sort_by="_score", # Sort by relevance
168
+ )
169
+ ```
170
+
171
+ ### Documents
172
+
173
+ ```python
174
+ # Get raw document content
175
+ content = client.get_document(document_id) # Returns bytes
176
+
177
+ # Get as JSON
178
+ doc = client.get_document(document_id, output_format="json")
179
+ print(doc.file_name, doc.content_type)
180
+
181
+ # Generate PDF
182
+ pdf_bytes = client.get_pdf(document_id=document_id)
183
+ # Or entire filing
184
+ pdf_bytes = client.get_pdf(accession_number="0000320193-23-000077")
185
+ ```
186
+
187
+ ### Financial Data
188
+
189
+ ```python
190
+ # Get financial statements
191
+ balance_sheet = client.get_balance_sheet(cik="320193")
192
+ income_stmt = client.get_income_statement(cik="320193")
193
+ cash_flow = client.get_cash_flow(cik="320193")
194
+
195
+ # Get raw XBRL data
196
+ raw = client.get_raw_financials(cik="320193")
197
+
198
+ # List available filings
199
+ filings = client.list_financial_filings(cik="320193")
200
+
201
+ # Get historical data for a concept
202
+ history = client.get_financial_history(cik="320193", concept="us-gaap:Revenue")
203
+
204
+ # Export to Excel
205
+ xlsx_bytes = client.export_financials_excel(cik="320193")
206
+ with open("financials.xlsx", "wb") as f:
207
+ f.write(xlsx_bytes)
208
+ ```
209
+
210
+ ## Error Handling
211
+
212
+ ```python
213
+ from secblast import (
214
+ SecBlastClient,
215
+ AuthenticationError,
216
+ RateLimitError,
217
+ ValidationError,
218
+ )
219
+
220
+ client = SecBlastClient(api_key="your-api-key")
221
+
222
+ try:
223
+ entity = client.get_entity(ticker="AAPL")
224
+ except AuthenticationError:
225
+ print("Invalid API key")
226
+ except RateLimitError as e:
227
+ print(f"Rate limit exceeded: {e.limit_type}")
228
+ except ValidationError as e:
229
+ print(f"Invalid request: {e.message}")
230
+ ```
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1,197 @@
1
+ # SecBlast Python SDK
2
+
3
+ Python SDK for the [SecBlast SEC Filing API](https://secblastapi.com).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install secblast
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from secblast import SecBlastClient
15
+
16
+ # Initialize the client
17
+ client = SecBlastClient(api_key="your-api-key")
18
+
19
+ # Look up a company
20
+ entity = client.get_entity(ticker="AAPL")
21
+ print(f"{entity.name} (CIK: {entity.cik})")
22
+
23
+ # Search filings
24
+ filings = client.lookup_filings(
25
+ tickers=["AAPL"],
26
+ form_types=["10-K"],
27
+ date_from="2023-01-01",
28
+ )
29
+ print(f"Found {filings.count} filings")
30
+
31
+ # Full-text search
32
+ results = client.fulltext_search(
33
+ "material contract",
34
+ form_types=["8-K"],
35
+ )
36
+ for hit in results.hits:
37
+ print(f"{hit.accession_number}: {hit.text_content[:100]}...")
38
+
39
+ # Get financial data
40
+ balance_sheet = client.get_balance_sheet(cik="320193")
41
+ ```
42
+
43
+ ## Async Support
44
+
45
+ ```python
46
+ import asyncio
47
+ from secblast import AsyncSecBlastClient
48
+
49
+ async def main():
50
+ async with AsyncSecBlastClient(api_key="your-api-key") as client:
51
+ entity = await client.get_entity(ticker="AAPL")
52
+ print(entity.name)
53
+
54
+ asyncio.run(main())
55
+ ```
56
+
57
+ ## API Reference
58
+
59
+ ### Entity Lookup
60
+
61
+ ```python
62
+ # Search entities with filters
63
+ entities = client.lookup_entities(
64
+ tickers=["AAPL", "MSFT"],
65
+ exchanges=["NASDAQ"],
66
+ sics=["3571"], # Electronic Computers
67
+ name_includes=["tech"],
68
+ )
69
+
70
+ # Get single entity
71
+ entity = client.get_entity(ticker="AAPL")
72
+ entity = client.get_entity(cik="320193")
73
+ ```
74
+
75
+ ### Filing Lookup
76
+
77
+ ```python
78
+ # Search filings
79
+ filings = client.lookup_filings(
80
+ tickers=["AAPL"],
81
+ form_types=["10-K", "10-Q"],
82
+ date_from="2023-01-01",
83
+ date_to="2023-12-31",
84
+ exclude_amendments=True,
85
+ sort_by="filing_date",
86
+ sort_order="desc",
87
+ )
88
+
89
+ # Get detailed filing info
90
+ detail = client.get_filing_info("0000320193-23-000077")
91
+ print(detail.filing.form_type)
92
+ print(len(detail.documents))
93
+
94
+ # Get 10-K/10-Q sections
95
+ sections = client.get_filing_sections(document_id, form_type="10-K")
96
+ for section in sections:
97
+ print(f"{section.id}: {section.name}")
98
+
99
+ # Batch fetch 8-K items
100
+ items = client.get_8k_items([
101
+ "0001829126-25-010357",
102
+ "0001213900-25-126699",
103
+ ])
104
+ ```
105
+
106
+ ### Full-Text Search
107
+
108
+ ```python
109
+ # Standard search
110
+ results = client.fulltext_search("revenue growth")
111
+
112
+ # Exact phrase
113
+ results = client.fulltext_search(
114
+ "material contract",
115
+ query_type="match_phrase",
116
+ )
117
+
118
+ # Lucene query syntax
119
+ results = client.fulltext_search(
120
+ "revenue AND NOT loss",
121
+ query_type="query_string",
122
+ )
123
+
124
+ # With filters
125
+ results = client.fulltext_search(
126
+ "merger agreement",
127
+ ciks=["320193"],
128
+ form_types=["8-K"],
129
+ date_from="2023-01-01",
130
+ sort_by="_score", # Sort by relevance
131
+ )
132
+ ```
133
+
134
+ ### Documents
135
+
136
+ ```python
137
+ # Get raw document content
138
+ content = client.get_document(document_id) # Returns bytes
139
+
140
+ # Get as JSON
141
+ doc = client.get_document(document_id, output_format="json")
142
+ print(doc.file_name, doc.content_type)
143
+
144
+ # Generate PDF
145
+ pdf_bytes = client.get_pdf(document_id=document_id)
146
+ # Or entire filing
147
+ pdf_bytes = client.get_pdf(accession_number="0000320193-23-000077")
148
+ ```
149
+
150
+ ### Financial Data
151
+
152
+ ```python
153
+ # Get financial statements
154
+ balance_sheet = client.get_balance_sheet(cik="320193")
155
+ income_stmt = client.get_income_statement(cik="320193")
156
+ cash_flow = client.get_cash_flow(cik="320193")
157
+
158
+ # Get raw XBRL data
159
+ raw = client.get_raw_financials(cik="320193")
160
+
161
+ # List available filings
162
+ filings = client.list_financial_filings(cik="320193")
163
+
164
+ # Get historical data for a concept
165
+ history = client.get_financial_history(cik="320193", concept="us-gaap:Revenue")
166
+
167
+ # Export to Excel
168
+ xlsx_bytes = client.export_financials_excel(cik="320193")
169
+ with open("financials.xlsx", "wb") as f:
170
+ f.write(xlsx_bytes)
171
+ ```
172
+
173
+ ## Error Handling
174
+
175
+ ```python
176
+ from secblast import (
177
+ SecBlastClient,
178
+ AuthenticationError,
179
+ RateLimitError,
180
+ ValidationError,
181
+ )
182
+
183
+ client = SecBlastClient(api_key="your-api-key")
184
+
185
+ try:
186
+ entity = client.get_entity(ticker="AAPL")
187
+ except AuthenticationError:
188
+ print("Invalid API key")
189
+ except RateLimitError as e:
190
+ print(f"Rate limit exceeded: {e.limit_type}")
191
+ except ValidationError as e:
192
+ print(f"Invalid request: {e.message}")
193
+ ```
194
+
195
+ ## License
196
+
197
+ MIT
@@ -0,0 +1,85 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "secblast"
7
+ version = "0.1.8"
8
+ description = "Python SDK for the SecBlast SEC Filing API"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.9"
13
+ authors = [
14
+ { name = "SEC Blast", email = "support@secblast.com" },
15
+ ]
16
+ keywords = [
17
+ "sec",
18
+ "edgar",
19
+ "filings",
20
+ "financial",
21
+ "api",
22
+ "sdk",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "Intended Audience :: Financial and Insurance Industry",
28
+ "License :: OSI Approved :: MIT License",
29
+ "Operating System :: OS Independent",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.9",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3.13",
36
+ "Topic :: Office/Business :: Financial",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ "Typing :: Typed",
39
+ ]
40
+ dependencies = [
41
+ "httpx>=0.25.0",
42
+ "pydantic>=2.0.0",
43
+ "eval_type_backport>=0.2.0; python_version < '3.10'",
44
+ ]
45
+
46
+ [project.optional-dependencies]
47
+ dev = [
48
+ "pytest>=7.0.0",
49
+ "pytest-asyncio>=0.21.0",
50
+ "respx>=0.20.0",
51
+ "ruff>=0.1.0",
52
+ "mypy>=1.0.0",
53
+ ]
54
+
55
+ [project.urls]
56
+ Homepage = "https://secblastapi.com"
57
+ Documentation = "https://docs.secblastapi.com"
58
+ Repository = "https://github.com/secblast/secblast-python"
59
+
60
+ [tool.hatch.build.targets.wheel]
61
+ packages = ["secblast"]
62
+
63
+ [tool.ruff]
64
+ target-version = "py310"
65
+ line-length = 100
66
+
67
+ [tool.ruff.lint]
68
+ select = [
69
+ "E", # pycodestyle errors
70
+ "W", # pycodestyle warnings
71
+ "F", # pyflakes
72
+ "I", # isort
73
+ "B", # flake8-bugbear
74
+ "UP", # pyupgrade
75
+ ]
76
+
77
+ [tool.mypy]
78
+ python_version = "3.10"
79
+ strict = true
80
+ warn_return_any = true
81
+ warn_unused_configs = true
82
+
83
+ [tool.pytest.ini_options]
84
+ asyncio_mode = "auto"
85
+ testpaths = ["tests"]