valuein-sdk 0.1.1__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.
@@ -0,0 +1,124 @@
1
+ ### Python template
2
+
3
+ utils/pipeline_state*
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.pyc
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Operating system / IDE files
15
+ .DS_Store
16
+ *.swp
17
+
18
+ # Distribution / packaging
19
+ .Python
20
+ build/
21
+ develop-eggs/
22
+ dist/
23
+ downloads/
24
+ eggs/
25
+ .eggs/
26
+ lib/
27
+ lib64/
28
+ parts/
29
+ sdist/
30
+ var/
31
+ wheels/
32
+ share/python-wheels/
33
+ *.egg-info/
34
+ .installed.cfg
35
+ *.egg
36
+ MANIFEST
37
+
38
+ # PyInstaller
39
+ # Usually these files are written by a python script from a template
40
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
41
+ *.manifest
42
+ *.spec
43
+
44
+ # Installer logs
45
+ pip-log.txt
46
+ pip-delete-this-directory.txt
47
+
48
+ # Unit test / coverage reports
49
+ htmlcov/
50
+ .tox/
51
+ .nox/
52
+ .coverage
53
+ .coverage.*
54
+ .cache
55
+ nosetests.xml
56
+ coverage.xml
57
+ *.cover
58
+ *.py,cover
59
+ .hypothesis/
60
+ .pytest_cache/
61
+ cover/
62
+
63
+ # Translations
64
+ *.mo
65
+ *.pot
66
+
67
+ # PyBuilder
68
+ .pybuilder/
69
+ target/
70
+
71
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
72
+ __pypackages__/
73
+
74
+ # Celery stuff
75
+ celerybeat-schedule
76
+ celerybeat.pid
77
+
78
+ # SageMath parsed files
79
+ *.sage.py
80
+
81
+ # Environments
82
+ .env
83
+ .venv
84
+ .uv/
85
+ env/
86
+ venv/
87
+ ENV/
88
+ env.bak/
89
+ venv.bak/
90
+
91
+ # Spyder project settings
92
+ .spyderproject
93
+ .spyproject
94
+
95
+ # Rope project settings
96
+ .ropeproject
97
+
98
+ # mkdocs documentation
99
+ /site
100
+
101
+ # mypy
102
+ .mypy_cache/
103
+ .dmypy.json
104
+ dmypy.json
105
+
106
+ # Pyre type checker
107
+ .pyre/
108
+
109
+ # pytype static type analyzer
110
+ .pytype/
111
+
112
+ # Cython debug symbols
113
+ cython_debug/
114
+
115
+ # VS Code
116
+ .vscode/
117
+
118
+ # Sublime Text
119
+ *.sublime-project
120
+ *.sublime-workspace
121
+
122
+ # Pycharm
123
+ .idea
124
+ *.db
@@ -0,0 +1,201 @@
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, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ Valuein SEC SDK
2
+ Copyright 2023-2026 Valuein LLC.
3
+
4
+ This product includes software developed at Valuein LLC (https://valuein.biz/).
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: valuein-sdk
3
+ Version: 0.1.1
4
+ Summary: Official Python SDK for the Valuein US Core Fundamentals dataset — SEC EDGAR financials via API.
5
+ Project-URL: Homepage, https://valuein.biz
6
+ Project-URL: Documentation, https://valuein.biz/docs
7
+ Project-URL: Repository, https://github.com/valuein/quants
8
+ Project-URL: Bug Tracker, https://github.com/valuein/quants/issues
9
+ Author-email: Valuein Data Engineering <support@valuein.biz>
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: EDGAR,SEC,duckdb,finance,fundamentals,parquet
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Office/Business :: Financial :: Investment
21
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: duckdb>=1.1.0
24
+ Requires-Dist: pandas>=2.0.0
25
+ Requires-Dist: pyarrow>=14.0.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Requires-Dist: requests>=2.32.0
28
+ Provides-Extra: research
29
+ Requires-Dist: ipykernel>=6.29.0; extra == 'research'
30
+ Requires-Dist: jupytext>=1.16.0; extra == 'research'
31
+ Requires-Dist: matplotlib>=3.8.0; extra == 'research'
32
+ Requires-Dist: numpy>=1.26.0; extra == 'research'
33
+ Provides-Extra: test
34
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
35
+ Requires-Dist: pytest>=9.0.0; extra == 'test'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # 🏛️ Valuein Financial Data Essentials (FDE) - Public Resources
39
+
40
+ [![Data Quality](https://img.shields.io/badge/Data_Quality-99.9%25-green)]()
41
+ [![Update Frequency](https://img.shields.io/badge/Updates-Daily-blue)]()
42
+ [![Python](https://img.shields.io/badge/Python-3.12%2B-green)]()
43
+
44
+ **Professional-grade SEC financial data for financial analysts, quantitative researchers, data engineers, and investment teams.**
45
+
46
+ ## 👋 Welcome
47
+
48
+ This repository is the official integration hub for the Valuein Financial Data Essentials feed. It hosts our Python SDK, issue tracker, schema definitions, and production usage patterns.
49
+
50
+ Our dataset includes all US public companies since 1990 (active and inactive). Both our sample and full datasets are Point-in-Time (PIT) and Survivorship-bias FREE.
51
+
52
+ ## 📦 Installation
53
+ The SDK is built on top of DuckDB for lightning-fast analytical queries directly against our R2-backed data lake.
54
+
55
+ * 1. Install the SDK
56
+ Install directly from GitHub using pip:
57
+
58
+ ```bash
59
+ pip install git+https://github.com/valuein/quants.git
60
+ ```
61
+
62
+ ### 2. Configure Credentials (.env)
63
+
64
+ The SDK automatically looks for a .env file or environment variables. Create a .env file in your project root:
65
+
66
+ ```bash
67
+ # .env
68
+ ACCOUNT_ID=account_id
69
+ ACCESS_KEY_ID=your_sample_access_key
70
+ SECRET_ACCESS_KEY=your_sample_secret_key
71
+ BUCKET_NAME=sec-sample-data
72
+ ```
73
+
74
+ > ### 🔑 Request Sample Data Access
75
+ > **To get free credentials for the S&P500 (historical) dataset, [Click Here](https://valuein.biz/sample-sec-data-request-access) 🚀**
76
+
77
+ FYI. Our full dataset include all US public companies since 1990 including active and inactive ones (bankrupts and mergers). Both datasets are PIT and Survivor-bias FREE.
78
+
79
+ ---
80
+
81
+ ## 🚀 Quickstart
82
+ The SDK handles the complex DuckDB/S3 connection logic, allowing you to focus on the data.
83
+
84
+ ### Option A: Standard SQL
85
+ Run raw SQL against our standardized views (entity, security, filing, fact, etc.).
86
+
87
+ ```python
88
+ from valuein_sec_sdk import ValueinClient
89
+
90
+ client = ValueinClient()
91
+
92
+ # Query NVIDIA's latest Revenue
93
+ df = client.query("""
94
+ SELECT s.symbol, f.report_date, fa.numeric_value
95
+ FROM security s
96
+ JOIN filing f ON s.entity_id = f.entity_id
97
+ JOIN fact fa ON f.accession_id = fa.accession_id
98
+ WHERE s.symbol = 'NVDA' AND fa.standard_concept = 'Revenues'
99
+ ORDER BY f.report_date DESC LIMIT 5
100
+ """)
101
+ print(df)
102
+ ```
103
+
104
+ ### Option B: Use Built-in Templates
105
+
106
+ ```python
107
+ # Run a pre-built fundamental analysis template
108
+ from valuein_sec_sdk import ValueinClient
109
+
110
+ client = ValueinClient()
111
+ df = client.run_showcase_query(
112
+ query_name="01_fundamentals_by_ticker",
113
+ ticker="AAPL",
114
+ metrics=["NetIncomeLoss", "Revenues"],
115
+ start_date="2022-01-01"
116
+ )
117
+ ```
118
+
119
+ ## 📚 Resources & Examples
120
+
121
+ Explore the /examples directory to see the SDK in action:
122
+
123
+ | Use Case | File | Description |
124
+ |:------------------|:----------------------------------------------------------------|:---------------------------------------------------------|
125
+ | **New Users** | [`examples/getting_started.py`](examples/getting_started.py) | The 5 core join patterns (Ticker-to-Fact, Taxonomy, etc.)|
126
+ | **SDK Usage** | [`examples/usage.py`](examples/usage.py) | How to use templates and pivot data for modeling. |
127
+
128
+ ## 📚 Documentation
129
+ * [**Data Catalog**](docs/DATA_CATALOG.xlsx): This Valuein Data Catalog serves as a massive 105M-facts dataset and the daily workflows of institutional analysts by providing transparent governance, clear taxonomy definitions, and high-performance API integration instructions.
130
+ * [**Compliance and DDQ**](docs/COMPLIANCE_AND_DDQ.md): Due Diligence Questionnaire, data sourcing disclosures, and SOC2/Governance standards.
131
+ * [**Schema Guide**](docs/SCHEMAS.md): Entity-Relationship Diagrams (ERD) and primary key mapping across the warehouse.
132
+ * [**Methodology Guide**](docs/METHODOLOGY.md): Our logic for handling restatements, fiscal period alignment, and Point-in-Time (PIT) integrity.
133
+
134
+ ## 🛡️ Data Governance & Methodology
135
+ We adhere to strict standards to ensure institutional-grade reliability.
136
+
137
+ * **SLA Policy**: Our commitment to 99.9% uptime and <2min SEC filing latency.
138
+ * * **Methodology**: We preserve "as-reported" history to support true point-in-time backtesting.
139
+ * **Restatement Handling**: We preserve "as-reported" history to support true point-in-time backtesting.
140
+
141
+
142
+ ## 🆘 Support & Community
143
+ * **Found a data error?** [Open a Data Ticket](https://github.com/valuein/quants/issues/new?template=01_data_quality_report.md)
144
+ * **General Question?** [Start a Discussion](https://github.com/valuein/quants/discussions)
145
+
146
+
147
+ ---
148
+
149
+ ⚠️ Disclaimer: This software is for educational and research purposes only. Valuein is not responsible for financial losses incurred through the use of this SDK.
150
+
151
+ ---
152
+
153
+ ## License
154
+
155
+ This project is licensed under the Apache-2.0 License. See the `LICENSE` file for more information.
@@ -0,0 +1,118 @@
1
+ # 🏛️ Valuein Financial Data Essentials (FDE) - Public Resources
2
+
3
+ [![Data Quality](https://img.shields.io/badge/Data_Quality-99.9%25-green)]()
4
+ [![Update Frequency](https://img.shields.io/badge/Updates-Daily-blue)]()
5
+ [![Python](https://img.shields.io/badge/Python-3.12%2B-green)]()
6
+
7
+ **Professional-grade SEC financial data for financial analysts, quantitative researchers, data engineers, and investment teams.**
8
+
9
+ ## 👋 Welcome
10
+
11
+ This repository is the official integration hub for the Valuein Financial Data Essentials feed. It hosts our Python SDK, issue tracker, schema definitions, and production usage patterns.
12
+
13
+ Our dataset includes all US public companies since 1990 (active and inactive). Both our sample and full datasets are Point-in-Time (PIT) and Survivorship-bias FREE.
14
+
15
+ ## 📦 Installation
16
+ The SDK is built on top of DuckDB for lightning-fast analytical queries directly against our R2-backed data lake.
17
+
18
+ * 1. Install the SDK
19
+ Install directly from GitHub using pip:
20
+
21
+ ```bash
22
+ pip install git+https://github.com/valuein/quants.git
23
+ ```
24
+
25
+ ### 2. Configure Credentials (.env)
26
+
27
+ The SDK automatically looks for a .env file or environment variables. Create a .env file in your project root:
28
+
29
+ ```bash
30
+ # .env
31
+ ACCOUNT_ID=account_id
32
+ ACCESS_KEY_ID=your_sample_access_key
33
+ SECRET_ACCESS_KEY=your_sample_secret_key
34
+ BUCKET_NAME=sec-sample-data
35
+ ```
36
+
37
+ > ### 🔑 Request Sample Data Access
38
+ > **To get free credentials for the S&P500 (historical) dataset, [Click Here](https://valuein.biz/sample-sec-data-request-access) 🚀**
39
+
40
+ FYI. Our full dataset include all US public companies since 1990 including active and inactive ones (bankrupts and mergers). Both datasets are PIT and Survivor-bias FREE.
41
+
42
+ ---
43
+
44
+ ## 🚀 Quickstart
45
+ The SDK handles the complex DuckDB/S3 connection logic, allowing you to focus on the data.
46
+
47
+ ### Option A: Standard SQL
48
+ Run raw SQL against our standardized views (entity, security, filing, fact, etc.).
49
+
50
+ ```python
51
+ from valuein_sec_sdk import ValueinClient
52
+
53
+ client = ValueinClient()
54
+
55
+ # Query NVIDIA's latest Revenue
56
+ df = client.query("""
57
+ SELECT s.symbol, f.report_date, fa.numeric_value
58
+ FROM security s
59
+ JOIN filing f ON s.entity_id = f.entity_id
60
+ JOIN fact fa ON f.accession_id = fa.accession_id
61
+ WHERE s.symbol = 'NVDA' AND fa.standard_concept = 'Revenues'
62
+ ORDER BY f.report_date DESC LIMIT 5
63
+ """)
64
+ print(df)
65
+ ```
66
+
67
+ ### Option B: Use Built-in Templates
68
+
69
+ ```python
70
+ # Run a pre-built fundamental analysis template
71
+ from valuein_sec_sdk import ValueinClient
72
+
73
+ client = ValueinClient()
74
+ df = client.run_showcase_query(
75
+ query_name="01_fundamentals_by_ticker",
76
+ ticker="AAPL",
77
+ metrics=["NetIncomeLoss", "Revenues"],
78
+ start_date="2022-01-01"
79
+ )
80
+ ```
81
+
82
+ ## 📚 Resources & Examples
83
+
84
+ Explore the /examples directory to see the SDK in action:
85
+
86
+ | Use Case | File | Description |
87
+ |:------------------|:----------------------------------------------------------------|:---------------------------------------------------------|
88
+ | **New Users** | [`examples/getting_started.py`](examples/getting_started.py) | The 5 core join patterns (Ticker-to-Fact, Taxonomy, etc.)|
89
+ | **SDK Usage** | [`examples/usage.py`](examples/usage.py) | How to use templates and pivot data for modeling. |
90
+
91
+ ## 📚 Documentation
92
+ * [**Data Catalog**](docs/DATA_CATALOG.xlsx): This Valuein Data Catalog serves as a massive 105M-facts dataset and the daily workflows of institutional analysts by providing transparent governance, clear taxonomy definitions, and high-performance API integration instructions.
93
+ * [**Compliance and DDQ**](docs/COMPLIANCE_AND_DDQ.md): Due Diligence Questionnaire, data sourcing disclosures, and SOC2/Governance standards.
94
+ * [**Schema Guide**](docs/SCHEMAS.md): Entity-Relationship Diagrams (ERD) and primary key mapping across the warehouse.
95
+ * [**Methodology Guide**](docs/METHODOLOGY.md): Our logic for handling restatements, fiscal period alignment, and Point-in-Time (PIT) integrity.
96
+
97
+ ## 🛡️ Data Governance & Methodology
98
+ We adhere to strict standards to ensure institutional-grade reliability.
99
+
100
+ * **SLA Policy**: Our commitment to 99.9% uptime and <2min SEC filing latency.
101
+ * * **Methodology**: We preserve "as-reported" history to support true point-in-time backtesting.
102
+ * **Restatement Handling**: We preserve "as-reported" history to support true point-in-time backtesting.
103
+
104
+
105
+ ## 🆘 Support & Community
106
+ * **Found a data error?** [Open a Data Ticket](https://github.com/valuein/quants/issues/new?template=01_data_quality_report.md)
107
+ * **General Question?** [Start a Discussion](https://github.com/valuein/quants/discussions)
108
+
109
+
110
+ ---
111
+
112
+ ⚠️ Disclaimer: This software is for educational and research purposes only. Valuein is not responsible for financial losses incurred through the use of this SDK.
113
+
114
+ ---
115
+
116
+ ## License
117
+
118
+ This project is licensed under the Apache-2.0 License. See the `LICENSE` file for more information.
@@ -0,0 +1,172 @@
1
+ # SEC Alpha Showcase: Institutional Grade Financial Data
2
+
3
+ Welcome to the SEC Alpha Showcase. This repository provides executable engineering scripts and analytical modules demonstrating how to extract alpha from our high-fidelity, dual-exported SEC data feed.
4
+
5
+ Our pipeline parses, standardizes, and delivers point-in-time SEC filings (10-K, 10-Q, 8-K, 20-F and their amendments) mapped to the S&P 500 (Sample Dataset) and the broader US equity market (Production) since 1990. Delivered via ZSTD-compressed Parquet files hosted on Cloudflare R2, our architecture enables lightning-fast, zero-copy analytics using highly efficient columnar engines like DuckDB.
6
+
7
+ ---
8
+
9
+ ## 🏛️ The Architecture: Zero-Copy Cloud Data Lake
10
+
11
+ Institutional data engineering is traditionally plagued by massive ETL pipelines, redundant storage costs, and stale database syncs. We bypassed this entirely by separating storage from compute.
12
+
13
+ Our delivery mechanism allows your quantitative and fundamental teams to query over **105 million standardized financial facts in milliseconds, directly over the network, with zero local storage required.**
14
+
15
+ * **The Storage (Cloudflare R2):** Data is exported daily into heavily compressed, columnar Parquet files via a Blue/Green deployment model. A dynamic `manifest.json` ensures you are always querying the latest immutable snapshot with zero downtime.
16
+ * **The Compute (DuckDB + PyArrow):** Using the `httpfs` extension, DuckDB executes queries directly against our R2 bucket. Because Parquet is columnar, DuckDB only downloads the specific bytes required for your query—not the whole file.
17
+ * **The Result:** You can run complex cross-sectional backtests across the entire US equity market directly from a Jupyter Notebook on your laptop, without downloading a single megabyte to your local hard drive.
18
+
19
+ ---
20
+
21
+ ## 🏗️ Repository Structure
22
+
23
+ This showcase is divided into four domains tailored to specific institutional workflows:
24
+
25
+ ### 1. 🛡️ Quality Assurance & Proofs (`/quality_proof`)
26
+ Quants require pristine data. These scripts execute directly against our dataset to prove the absence of systemic data errors.
27
+ * **`01_survivorship_bias_proof.py`**: Proves the dataset retains complete financial histories for defunct, bankrupt, and acquired companies (historical S&P 500 constituents).
28
+ * **`02_point_in_time_proof.py`**: Proves strict Point-In-Time (PIT) architecture by calculating the exact "Reporting Lag" between a fiscal `period_end` and the public `filing_date` to guarantee no look-ahead bias.
29
+
30
+ ### 2. 📊 Quantitative Research (`/quantitative_analysis`)
31
+ For Systematic Quants running cross-sectional backtests and signal generation.
32
+ * **`01_piotroski_f_score_backtest.py`**: Calculates the 9-point Piotroski F-Score utilizing window functions across the entire universe simultaneously to identify value stocks with improving financial health.
33
+ * **`02_post_earnings_announcement_drift.py`**: Evaluates Post-Earnings Announcement Drift (PEAD) by joining point-in-time SEC EPS data with trailing market pricing.
34
+
35
+ ### 3. 💼 Fundamental Analysis (`/fundamental_analysis`)
36
+ For discretionary Equity Analysts focusing on deep company teardowns.
37
+ * **`01_sp500_value_screener.py`**: A cross-sectional screener joining facts and SEC taxonomy maps to identify high Free Cash Flow yield and conservative leverage.
38
+ * **`02_dcf_and_roic_teardown.py`**: Reconstructs a historical Return on Invested Capital (ROIC) trendline for a single ticker to quantitatively assess economic moats.
39
+
40
+ ### 4. 🛠️ Data Engineering (`/engineering`)
41
+ For Data Engineers integrating our feed into local data lakes or cloud warehouses.
42
+ * **`r2_inspector.py`**: Query the live Cloudflare R2 bucket directly over the network using DuckDB.
43
+ * **`bulk_sync_to_local.py`**: A pure-Python Boto3 script to safely and incrementally mirror the latest daily release to your local storage.
44
+
45
+ ---
46
+
47
+ ### 3. Running the Showcases
48
+
49
+ The showcases in this repository are provided as interactive Python scripts formatted with # %% markers (Scientific Mode).
50
+
51
+ * Using PyCharm / VS Code: Open any .py file in the notebooks/ directories. Your IDE will recognize the # %% markers and allow you to run the file cell-by-cell interactively.
52
+
53
+ * Using Jupyter: If you prefer standard .ipynb files, you can easily convert the provided scripts using jupytext:
54
+
55
+ ```bash
56
+ pip install jupytext
57
+ jupytext --to notebook engineering/notebooks/quickstart.py
58
+ ```
59
+
60
+ ## Data Schema Overview
61
+
62
+ The dataset is fully normalized for institutional quantitative research. It separates the legal entity from the tradeable security, tracks filing metadata, and provides a strictly Point-in-Time (PiT) fact table for fundamental metrics.
63
+
64
+
65
+ ### 1. `entity` (The Legal Structure)
66
+ Tracks the corporate metadata for the issuing company.
67
+ * **Primary Key:** `cik` (Central Index Key)
68
+
69
+ | Column | Type | Description |
70
+ | :--- | :--- | :--- |
71
+ | `cik` | String | The 10-digit SEC identifier. |
72
+ | `name` / `lei` / `ein` | String | Corporate name and legal identifiers. |
73
+ | `industry` / `sector` / `sic_code` | String | Standardized industry classifications. |
74
+ | `fiscal_year_end` | String | The month and day the fiscal year ends. |
75
+ | `status` | String | Active or inactive status of the entity. |
76
+
77
+ ### 2. `security` (The Tradeable Instrument)
78
+ Maps point-in-time ticker symbols and identifiers to the legal entity. This handles ticker changes and delistings gracefully.
79
+ * **Primary Key:** `id`
80
+ * **Foreign Key:** `entity_id` -> `entity.cik`
81
+
82
+ | Column | Type | Description |
83
+ | :--- | :--- | :--- |
84
+ | `symbol` / `exchange` | String | The trading ticker and listed exchange. |
85
+ | `figi` / `composite_figi` | String | Financial Instrument Global Identifiers. |
86
+ | `valid_from` / `valid_to` | Date | The exact date range this symbol was active. |
87
+ | `is_active` | Boolean | Auto-generated flag for currently active tickers. |
88
+
89
+ ### 3. `filing` (Submission Metadata)
90
+ Contains the metadata for the actual document submitted to the SEC.
91
+ * **Primary Key:** `accession_id`
92
+ * **Foreign Key:** `entity_id` -> `entity.cik`
93
+
94
+ | Column | Type | Description |
95
+ | :--- | :--- | :--- |
96
+ | `accession_id` | String | The unique SEC filing identifier. |
97
+ | `form_type` | String | The document type (e.g., `10-K`, `10-Q`, `8-K`). |
98
+ | `filing_date` / `report_date` | Date | When it was filed vs. the period it covers. |
99
+ | `accepted_at` | Timestamp | The exact time the SEC accepted the filing. |
100
+
101
+ ### 4. `fact` (Fundamental Data Points)
102
+ The core time-series table containing all extracted accounting metrics. Partitioned by `period_end` for high-performance querying.
103
+
104
+ | Column | Type | Description |
105
+ | :--- | :--- | :--- |
106
+ | `concept` | String | The raw XBRL tag from the filing. |
107
+ | `standard_concept` | String | The mapped, normalized accounting concept. |
108
+ | `numeric_value` / `value` | Float / String | The extracted value (numeric or text). |
109
+ | `unit` | String | The unit of measurement (e.g., `USD`, `shares`). |
110
+ | `period_start` / `period_end` | Date | The exact accounting period the metric covers. |
111
+ | `frame` | String | Standardized SEC frame (e.g., `CY2023Q1`). |
112
+ | `knowledge_at` | Timestamp | **CRITICAL:** The exact microsecond the data became public. Use this to prevent look-ahead bias. |
113
+
114
+ ### 5. Reference Tables
115
+ Helper tables designed to map raw SEC XBRL tags to standardized institutional metrics and track index components.
116
+
117
+ * **`index_membership`**: Tracks which securities belonged to which indices (e.g., S&P 500) at specific point-in-time dates (`start_date` / `end_date`).
118
+ * **`concept_mapping`**: Maps messy, raw `xbrl_tag` variations into a single `standard_concept`.
119
+ * **`taxonomy_guide`**: A data dictionary defining every `standard_concept`, including its `balance_type` (debit/credit) and human-readable definitions.
120
+
121
+ ---
122
+
123
+ ## Advanced: The Point-in-Time Join
124
+
125
+ To build a robust quantitative backtest, you must join the fundamental metrics with the historically accurate ticker symbol active at the exact time of the filing.
126
+
127
+ Because companies change tickers (e.g., Facebook changing from FB to META), joining purely on today's ticker introduces look-ahead bias. Our `security` table tracks the exact `valid_from` and `valid_to` dates for every ticker.
128
+
129
+ Below is an example using DuckDB to extract a clean, Point-in-Time time-series of Net Income for a specific company, ensuring we capture the exact ticker symbol the market was trading on the day the filing dropped.
130
+
131
+
132
+ ```python
133
+ import duckdb
134
+
135
+ # Assuming your R2 credentials and latest_path are already configured in DuckDB...
136
+
137
+ pit_query = f"""
138
+ SELECT
139
+ s.symbol AS historical_ticker,
140
+ f.standard_concept,
141
+ f.numeric_value AS value,
142
+ f.unit,
143
+ f.period_end,
144
+ fil.form_type,
145
+ f.knowledge_at AS market_aware_timestamp
146
+ FROM read_parquet('r2://{BUCKET}/{latest_path}fact/*.parquet') f
147
+
148
+ -- 1. Join Document Metadata
149
+ JOIN read_parquet('r2://{BUCKET}/{latest_path}filing/*.parquet') fil
150
+ ON f.accession_id = fil.accession_id
151
+
152
+ -- 2. Join Historical Security Data
153
+ JOIN read_parquet('r2://{BUCKET}/{latest_path}security/*.parquet') s
154
+ ON f.entity_id = s.entity_id
155
+
156
+ WHERE f.standard_concept = 'NetIncomeLoss'
157
+ AND f.frame LIKE 'CY%' -- Annual data only
158
+
159
+ -- 3. The Point-in-Time Ticker Constraint
160
+ -- This ensures we only map the ticker that was active at the exact moment the filing became public.
161
+ AND f.knowledge_at >= s.valid_from
162
+ AND (s.valid_to IS NULL OR f.knowledge_at <= s.valid_to)
163
+
164
+ -- Filter for a specific company using its permanent CIK
165
+ AND f.entity_id = '0000320193'
166
+
167
+ ORDER BY f.knowledge_at DESC
168
+ LIMIT 5;
169
+ """
170
+
171
+ df_historical = con.execute(pit_query).df()
172
+ print(df_historical)
@@ -0,0 +1,63 @@
1
+ [project]
2
+ name = "valuein-sdk"
3
+ version = "0.1.1"
4
+ description = "Official Python SDK for the Valuein US Core Fundamentals dataset — SEC EDGAR financials via API."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = {text = "Apache-2.0"}
8
+ authors = [{name = "Valuein Data Engineering", email = "support@valuein.biz"}]
9
+ keywords = ["SEC", "EDGAR", "finance", "fundamentals", "parquet", "duckdb"]
10
+ classifiers = [
11
+ "License :: OSI Approved :: Apache Software License",
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: Financial and Insurance Industry",
17
+ "Topic :: Office/Business :: Financial :: Investment",
18
+ "Topic :: Scientific/Engineering :: Information Analysis",
19
+ ]
20
+
21
+ dependencies = [
22
+ "duckdb>=1.1.0",
23
+ "pandas>=2.0.0",
24
+ "pyarrow>=14.0.0",
25
+ "requests>=2.32.0",
26
+ "python-dotenv>=1.0.0",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ research = [
31
+ "numpy>=1.26.0",
32
+ "matplotlib>=3.8.0",
33
+ "ipykernel>=6.29.0",
34
+ "jupytext>=1.16.0",
35
+ ]
36
+ test = [
37
+ "pytest>=9.0.0",
38
+ "pytest-cov>=4.1.0",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://valuein.biz"
43
+ Documentation = "https://valuein.biz/docs"
44
+ Repository = "https://github.com/valuein/quants"
45
+ "Bug Tracker" = "https://github.com/valuein/quants/issues"
46
+
47
+ [build-system]
48
+ requires = ["hatchling"]
49
+ build-backend = "hatchling.build"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["valuein_sec_sdk"]
53
+
54
+ [tool.hatch.build.targets.sdist]
55
+ include = ["valuein_sec_sdk/**", "README.md", "LICENSE"]
56
+
57
+ [dependency-groups]
58
+ dev = [
59
+ "pytest>=9.0.0",
60
+ "pytest-cov>=4.1.0",
61
+ "ruff>=0.3.0",
62
+ "hatch>=1.9.0",
63
+ ]