insider-trades-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .eggs/
5
+ build/
6
+ dist/
7
+ .venv/
8
+ venv/
9
+ .env
10
+ .mypy_cache/
11
+ .pytest_cache/
12
+ .ruff_cache/
@@ -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.
@@ -0,0 +1,319 @@
1
+ Metadata-Version: 2.4
2
+ Name: insider-trades-api
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Insider Trades API — real-time SEC Form 3, 4, and 5 insider transaction data.
5
+ Project-URL: Homepage, https://insidertrades.us
6
+ Project-URL: Documentation, https://insidertrades.us/docs
7
+ Project-URL: Pricing, https://insidertrades.us/pricing
8
+ Author-email: GoodTech LLC <dev@goodtechllc.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: api-client,edgar,financial-data,fintech,form-3,form-4,form-5,insider-trading,insider-transactions,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
+ # Insider Trades API — Python SDK
30
+
31
+ Official Python SDK for the [Insider Trades API](https://insidertrades.us) — real-time SEC Form 3, 4, and 5 insider transaction data.
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install insider-trades-api
37
+ ```
38
+
39
+ Requires Python 3.8+. No runtime dependencies.
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ import os
45
+ from insider_trades_api import InsiderTradesAPI
46
+
47
+ client = InsiderTradesAPI(api_key=os.environ["INSIDER_TRADES_API_KEY"])
48
+
49
+ # Get recent insider purchases for Apple
50
+ result = client.get_insider_transactions(
51
+ issuer_ticker="AAPL",
52
+ transaction_types="purchase",
53
+ limit=10,
54
+ )
55
+
56
+ for tx in result["insiderTransactions"]:
57
+ owner = tx.get("reportingOwnerInformation", {})
58
+ print(owner.get("name"), tx.get("purchaseAmount"))
59
+ ```
60
+
61
+ If you omit `api_key`, the client reads `INSIDER_TRADES_API_KEY` from the environment.
62
+
63
+ Get your API key at [insidertrades.us](https://insidertrades.us).
64
+
65
+ ---
66
+
67
+ ## API Reference
68
+
69
+ For the full reference including all parameters, response schemas, and plan limits, see [insidertrades.us/docs](https://insidertrades.us/docs).
70
+
71
+ ### `InsiderTradesAPI(api_key=None, *, timeout=30.0)`
72
+
73
+ | Argument | Type | Required | Description |
74
+ |---|---|---|---|
75
+ | `api_key` | `str` | Yes | Your API key. Falls back to `INSIDER_TRADES_API_KEY` env var |
76
+ | `timeout` | `float` | No | Per-request socket timeout in seconds (default `30.0`) |
77
+
78
+ ---
79
+
80
+ ### `get_insider_transactions(**params)`
81
+
82
+ Retrieve SEC insider transactions from Form 3, 4, and 5 filings. All arguments are keyword-only. Returns the decoded JSON response as a `dict` with `insiderTransactions`, `count`, and `recordedTimeInUtc`.
83
+
84
+ ```python
85
+ result = client.get_insider_transactions(
86
+ issuer_ticker="AAPL",
87
+ transaction_types=["purchase", "sale"],
88
+ filing_date_in_est_start_date="2026-01-01",
89
+ filing_date_in_est_end_date="2026-01-31",
90
+ limit=50,
91
+ )
92
+ print(result["count"], len(result["insiderTransactions"]))
93
+ ```
94
+
95
+ | Parameter | Type | Description |
96
+ |---|---|---|
97
+ | `filing_id` | `str` | Direct lookup by filing ID |
98
+ | `issuer_ticker` | `str` | Filter by ticker symbol, e.g. `"AAPL"` |
99
+ | `issuer_cik` | `str` | Filter by issuer CIK |
100
+ | `reporting_owner_cik` | `str` | Filter by insider CIK |
101
+ | `accession_number` | `str` | Filter by SEC accession number |
102
+ | `form_types` | `str \| Sequence[str]` | Form types: `"3"`, `"4"`, `"5"` (default: all) |
103
+ | `transaction_types` | `str \| Sequence[str]` | See transaction types below |
104
+ | `owner_roles` | `str \| Sequence[str]` | `"director"`, `"officer"`, `"tenPercentOwner"` |
105
+ | `officer_titles` | `str \| Sequence[str]` | Normalized titles: `"CEO"`, `"CFO"`, `"COO"`, etc. |
106
+ | `filing_date_in_est_start_date` | `str` | Filing date start `YYYY-MM-DD` (Eastern Time) |
107
+ | `filing_date_in_est_end_date` | `str` | Filing date end `YYYY-MM-DD` (Eastern Time) |
108
+ | `period_of_report_start_date` | `str` | Period of report start `YYYY-MM-DD` |
109
+ | `period_of_report_end_date` | `str` | Period of report end `YYYY-MM-DD` |
110
+ | `min_total_amount` | `float` | Minimum total dollar value |
111
+ | `max_total_amount` | `float` | Maximum total dollar value |
112
+ | `fieldset` | `"minimal" \| "standard" \| "full"` | Control response size (see below) |
113
+ | `limit` | `int` | Max results, default `100`, max `900` |
114
+
115
+ #### Transaction types
116
+
117
+ | Value | SEC Code | Description |
118
+ |-------|----------|-------------|
119
+ | `"purchase"` | P | Open market purchase |
120
+ | `"sale"` | S | Open market sale |
121
+ | `"grant"` | A | Grant or award |
122
+ | `"gift"` | G | Bona fide gift |
123
+ | `"exercise"` | M | Option exercise (Rule 16b-3) |
124
+ | `"derivativeExercise"` | O, X | Derivative exercise |
125
+ | `"disposition"` | D | Disposition to issuer |
126
+ | `"discretionary"` | I | Discretionary transaction |
127
+ | `"derivativeConversion"` | C | Conversion of derivative |
128
+ | `"derivativeExpiration"` | E, H | Expiration of derivative |
129
+ | `"smallAcquisition"` | L | Small acquisition (Rule 16a-6) |
130
+ | `"inheritance"` | W | Inheritance |
131
+ | `"equitySwap"` | K | Equity swap |
132
+ | `"tender"` | U | Tender offer / change of control |
133
+ | `"other"` | J | Other acquisition / disposition |
134
+
135
+ #### Fieldsets
136
+
137
+ | Fieldset | Fields included |
138
+ |---|---|
139
+ | `"minimal"` | ID, issuer, owner, key amounts, dates |
140
+ | `"standard"` | All of minimal + all aggregates, boolean flags, links, AI summary |
141
+ | `"full"` | All of standard + raw transaction arrays (`nonDerivativeTransactions`, `derivativeTransactions`, holdings) |
142
+
143
+ Default (no `fieldset`): all stored fields are returned. `minimal` and `standard` produce significantly smaller payloads — recommended for bulk queries.
144
+
145
+ **Sample response:**
146
+
147
+ ```json
148
+ {
149
+ "insiderTransactions": [
150
+ {
151
+ "id": "97e823b724619e921c68ba73b2f95f3b015fb83cc05666320b6ddf34b97cdcbe",
152
+ "formType": "4",
153
+ "accessionNumber": "0001140361-26-023363",
154
+ "issuerCik": "320193",
155
+ "issuerInformation": {
156
+ "cik": "0000320193",
157
+ "tradingSymbol": "AAPL",
158
+ "companyName": "Apple Inc."
159
+ },
160
+ "reportingOwnerCik": "1214128",
161
+ "reportingOwnerInformation": {
162
+ "cik": "0001214128",
163
+ "name": "LEVINSON ARTHUR D",
164
+ "city": "CUPERTINO",
165
+ "state": "CA",
166
+ "isDirector": true,
167
+ "isOfficer": false
168
+ },
169
+ "ownerRoles": "director",
170
+ "filingDateInEst": "2026-05-29",
171
+ "periodOfReport": "2026-05-27",
172
+ "totalAmount": 15551000.0,
173
+ "saleAmount": 15551000.0,
174
+ "saleCount": 1,
175
+ "netSharesAcquired": -50000.0,
176
+ "netTradingAmount": -15551000.0,
177
+ "hasSales": "true",
178
+ "hasLateTransactions": false,
179
+ "aff10b5One": false,
180
+ "summary": "Arthur D. Levinson sold 50,000 shares of Apple Inc. common stock at $311.02 per share on May 27, 2026.",
181
+ "linkToFilingDetail": "https://www.sec.gov/Archives/edgar/data/1214128/000114036126023363/0001140361-26-023363-index.htm"
182
+ }
183
+ ],
184
+ "count": 1,
185
+ "recordedTimeInUtc": "2026-05-29T22:30:00Z"
186
+ }
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Usage examples
192
+
193
+ ### Recent Form 4 purchases by date range
194
+
195
+ ```python
196
+ result = client.get_insider_transactions(
197
+ transaction_types="purchase",
198
+ form_types="4",
199
+ filing_date_in_est_start_date="2026-05-01",
200
+ filing_date_in_est_end_date="2026-05-31",
201
+ limit=50,
202
+ )
203
+ ```
204
+
205
+ ### High-value transactions over $1M
206
+
207
+ ```python
208
+ result = client.get_insider_transactions(
209
+ min_total_amount=1_000_000,
210
+ transaction_types="purchase",
211
+ filing_date_in_est_start_date="2026-05-01",
212
+ filing_date_in_est_end_date="2026-05-31",
213
+ limit=25,
214
+ )
215
+ ```
216
+
217
+ ### All transactions by a specific insider
218
+
219
+ ```python
220
+ result = client.get_insider_transactions(reporting_owner_cik="1214128", limit=20)
221
+ ```
222
+
223
+ ### CEO transactions across all companies
224
+
225
+ ```python
226
+ result = client.get_insider_transactions(
227
+ officer_titles=["CEO"],
228
+ form_types="4",
229
+ filing_date_in_est_start_date="2026-05-01",
230
+ filing_date_in_est_end_date="2026-05-31",
231
+ limit=20,
232
+ )
233
+ ```
234
+
235
+ ### Look up a specific filing
236
+
237
+ ```python
238
+ result = client.get_insider_transactions(accession_number="0001140361-26-023363")
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Typing
244
+
245
+ The package ships with type hints (`py.typed`). Responses are plain `dict`s; `TypedDict` definitions describe their shape for editors and type checkers.
246
+
247
+ ```python
248
+ from insider_trades_api import (
249
+ InsiderTransaction,
250
+ InsiderTransactionsResponse,
251
+ IssuerInformation,
252
+ ReportingOwnerInformation,
253
+ NonDerivativeTransaction,
254
+ DerivativeTransaction,
255
+ NonDerivativeHolding,
256
+ DerivativeHolding,
257
+ Footnote,
258
+ OwnerSignature,
259
+ )
260
+ ```
261
+
262
+ > **Note:** the `has*` flags (`hasPurchases`, `hasSales`, …) are returned as the string `"true"`, not a Python `bool`. Use truthiness checks (`if tx.get("hasPurchases"):`) rather than `== True`.
263
+
264
+ ---
265
+
266
+ ## Error handling
267
+
268
+ Client-side validation failures raise `ValueError` before any network call. Non-success HTTP responses raise `InsiderTradesAPIError`, which carries the HTTP `status`.
269
+
270
+ ```python
271
+ from insider_trades_api import InsiderTradesAPI, InsiderTradesAPIError
272
+
273
+ try:
274
+ result = client.get_insider_transactions(issuer_ticker="AAPL")
275
+ except InsiderTradesAPIError as err:
276
+ print(err.status, err) # e.g. 403 "InsiderTrades API error 403: Forbidden"
277
+ ```
278
+
279
+ | Status | Meaning |
280
+ |---|---|
281
+ | 400 | Invalid parameters (bad date format, invalid CIK, inverted date range) |
282
+ | 403 | Invalid or missing API key, or requested date range exceeds plan limit |
283
+ | 429 | Rate limit exceeded — retried automatically up to 3 times with backoff |
284
+ | 504 | Request timed out — retried automatically up to 3 times |
285
+ | 500 | Server error |
286
+
287
+ The SDK validates date format (`YYYY-MM-DD`), numeric CIK, and date range order before making any network request, so many errors are caught immediately without a round trip.
288
+
289
+ ---
290
+
291
+ ## Changelog
292
+
293
+ ### [0.1.0] - 2026-06-05
294
+
295
+ - Initial release: `get_insider_transactions()` with full query parameter support
296
+ - Filters: issuer_ticker, issuer_cik, reporting_owner_cik, transaction_types, owner_roles, officer_titles, date ranges, min_total_amount, max_total_amount, fieldset
297
+ - Retry logic for 429 and 504 with backoff
298
+ - Client-side input validation for date format, CIK format, and date range order
299
+ - Full type hints (`py.typed`) including transaction arrays, holdings, and boolean flags
300
+ - Zero runtime dependencies (stdlib only)
301
+
302
+ ---
303
+
304
+ ## Resources
305
+
306
+ - Docs: [insidertrades.us/docs](https://insidertrades.us/docs)
307
+ - Pricing: [insidertrades.us/pricing](https://insidertrades.us/pricing)
308
+ - Dashboard: [insidertrades.us/dashboard](https://insidertrades.us/dashboard)
309
+ - Support: [insidertrades.us](https://insidertrades.us)
310
+
311
+ ---
312
+
313
+ ## Legal disclaimer
314
+
315
+ 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. Past filings and transactions do not predict future performance. Always consult a qualified financial professional before making investment decisions.
316
+
317
+ ---
318
+
319
+ Licensed under the [Apache 2.0 License](./LICENSE). Copyright 2026 GoodTech LLC.