finbrain-python 0.2.8__tar.gz → 0.2.9__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 (92) hide show
  1. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/CHANGELOG.md +12 -1
  2. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/PKG-INFO +27 -7
  3. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/README.md +26 -6
  4. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/house_trades.py +3 -3
  5. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/screener.py +3 -2
  6. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/senate_trades.py +3 -3
  7. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/house_trades.py +6 -6
  8. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/screener.py +3 -2
  9. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/senate_trades.py +6 -6
  10. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/PKG-INFO +27 -7
  11. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/SOURCES.txt +1 -0
  12. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/scm_file_list.json +60 -59
  13. finbrain_python-0.2.9/src/finbrain_python.egg-info/scm_version.json +8 -0
  14. finbrain_python-0.2.9/tests/test_cik_passthrough.py +160 -0
  15. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_house_trades.py +1 -1
  16. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_integration.py +8 -8
  17. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_screener.py +2 -2
  18. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_senate_trades.py +1 -1
  19. finbrain_python-0.2.8/src/finbrain_python.egg-info/scm_version.json +0 -8
  20. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/.gitattributes +0 -0
  21. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/.github/workflows/ci.yml +0 -0
  22. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/.github/workflows/release.yml +0 -0
  23. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/.gitignore +0 -0
  24. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/LICENSE +0 -0
  25. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/RELEASE.md +0 -0
  26. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/examples/async_example.py +0 -0
  27. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/examples/transactions_plotting_example.py +0 -0
  28. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/pyproject.toml +0 -0
  29. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/setup.cfg +0 -0
  30. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/__init__.py +0 -0
  31. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/__init__.py +0 -0
  32. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/client.py +0 -0
  33. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/__init__.py +0 -0
  34. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/_utils.py +0 -0
  35. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/analyst_ratings.py +0 -0
  36. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/app_ratings.py +0 -0
  37. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/available.py +0 -0
  38. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/corporate_lobbying.py +0 -0
  39. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/government_contracts.py +0 -0
  40. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/insider_transactions.py +0 -0
  41. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/linkedin_data.py +0 -0
  42. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/news.py +0 -0
  43. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/options.py +0 -0
  44. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/patent_filings.py +0 -0
  45. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/predictions.py +0 -0
  46. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/recent.py +0 -0
  47. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/reddit_mentions.py +0 -0
  48. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/aio/endpoints/sentiments.py +0 -0
  49. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/client.py +0 -0
  50. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/__init__.py +0 -0
  51. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/_utils.py +0 -0
  52. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/analyst_ratings.py +0 -0
  53. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/app_ratings.py +0 -0
  54. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/available.py +0 -0
  55. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/corporate_lobbying.py +0 -0
  56. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/government_contracts.py +0 -0
  57. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/insider_transactions.py +0 -0
  58. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/linkedin_data.py +0 -0
  59. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/news.py +0 -0
  60. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/options.py +0 -0
  61. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/patent_filings.py +0 -0
  62. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/predictions.py +0 -0
  63. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/recent.py +0 -0
  64. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/reddit_mentions.py +0 -0
  65. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/endpoints/sentiments.py +0 -0
  66. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/exceptions.py +0 -0
  67. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/plotting.py +0 -0
  68. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain/py.typed +0 -0
  69. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/dependency_links.txt +0 -0
  70. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/requires.txt +0 -0
  71. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/src/finbrain_python.egg-info/top_level.txt +0 -0
  72. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/__init__.py +0 -0
  73. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/conftest.py +0 -0
  74. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_analyst_ratings.py +0 -0
  75. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_app_ratings.py +0 -0
  76. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_async_client.py +0 -0
  77. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_available.py +0 -0
  78. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_client.py +0 -0
  79. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_corporate_lobbying.py +0 -0
  80. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_envelope.py +0 -0
  81. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_government_contracts.py +0 -0
  82. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_insider_transactions.py +0 -0
  83. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_linkedin_data.py +0 -0
  84. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_news.py +0 -0
  85. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_options.py +0 -0
  86. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_patent_filings.py +0 -0
  87. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_plotting.py +0 -0
  88. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_predictions.py +0 -0
  89. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_recent.py +0 -0
  90. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_reddit_mentions.py +0 -0
  91. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_sentiments.py +0 -0
  92. {finbrain_python-0.2.8 → finbrain_python-0.2.9}/tests/test_utils.py +0 -0
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.9] - 2026-08-14
9
+
10
+ ### Added
11
+
12
+ - **`cik` field on four datasets**: rows from `fb.insider_transactions.ticker()`, `fb.government_contracts.ticker()`, `fb.corporate_lobbying.ticker()`, and `fb.patent_filings.ticker()` (and their async equivalents) now carry `cik` — the SEC Central Index Key of the company as of that record, as a 10-digit zero-padded **string** (`"0000320193"`); `null` where the record has no entity resolution. The field is emitted by the v2 API and passes through both the raw-dict and DataFrame branches with no SDK code changes; tests pin the passthrough (including that the DataFrame column stays string-typed — leading zeros are data)
13
+ - **Documentation**: README "Company identifier (`cik`)" section covering the field, its string typing, the null case, and its use for joining to SEC-keyed datasets
14
+
15
+ ### Changed
16
+
17
+ - **DataFrame shape**: `as_dataframe=True` frames for the four datasets above gain a `cik` column. Code that asserts an exact column set needs updating
18
+
8
19
  ## [0.2.8] - 2026-07-28
9
20
 
10
21
  ### Added
@@ -20,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
31
 
21
32
  ### Notes
22
33
 
23
- - `owner` is `null` on rows collected before the upstream pipeline captured the field, like `disclosureDate` — the `.dropna()` and `pandas.isna()` caveats from 0.2.6 apply to it as well
34
+ - `owner` and `disclosureDate` are nullable, but nulls are rare in practice: the pipeline's key-hygiene reconcile upload backfilled both fields onto historical rows in place. Code should still handle missing values with `pandas.isna()` — the `.dropna()` caveat from 0.2.6 applies to any row a reconcile could not fill
24
35
  - The raw-dict branch is purely additive — no call-site changes are required to receive the new fields
25
36
 
26
37
  ## [0.2.7] - 2026-07-24
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: Official Python client for the FinBrain API
5
5
  Author-email: Ahmet Salim Bilgin <ahmet@finbrain.tech>
6
6
  License-Expression: MIT
@@ -192,15 +192,35 @@ kept as filed. A filing with no usable amount at all reports `amount` as
192
192
  column blank report `owner` as `UNKNOWN`; House filings that leave it blank
193
193
  report `SELF`, per the House PTR-form instructions.
194
194
 
195
- `disclosureDate` and `owner` are `null` on historical rows collected before
196
- the fields were captured upstream. With `as_dataframe=True`, `date` is the
197
- **index** and the other fields are columns whose missing values read as
198
- `None` or `NaN` depending on your pandas version — test them with
199
- `pandas.isna()` rather than `is None`. Note that `.dropna()` on such a frame
200
- will discard every row with any missing field — use `.dropna(subset=[...])`.
195
+ `disclosureDate` and `owner` are nullable. Historical rows were backfilled
196
+ in place by the pipeline's reconcile upload, so nulls are rare — but code
197
+ should still handle them. With `as_dataframe=True`, `date` is the **index**
198
+ and the other fields are columns whose missing values read as `None` or
199
+ `NaN` depending on your pandas version — test them with `pandas.isna()`
200
+ rather than `is None`. Note that `.dropna()` on such a frame will discard
201
+ every row with any missing field — use `.dropna(subset=[...])`.
201
202
  `disclosureDate` and `owner` are also present on
202
203
  `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
203
204
 
205
+ ### Company identifier (`cik`)
206
+
207
+ Rows from the four SEC/government datasets — `fb.insider_transactions`,
208
+ `fb.government_contracts`, `fb.corporate_lobbying`, and `fb.patent_filings`
209
+ (ticker endpoints and their async equivalents) — carry `cik`, the SEC
210
+ **Central Index Key** of the company as of that record:
211
+
212
+ | Field | Meaning |
213
+ | ----- | ------------------------------------------------------------------------------------------- |
214
+ | `cik` | SEC Central Index Key of the company, as a 10-digit zero-padded string (`"0000320193"`) |
215
+
216
+ `cik` is a **string, not a number** — the leading zeros are part of the
217
+ identifier, so keep the column as text when loading into other tools. Rows
218
+ without an entity resolution (for example, records of companies absent from
219
+ the SEC's public company file) carry `null`; with `as_dataframe=True` the
220
+ column stays object-typed and missing values read as `None`. Use it to join
221
+ FinBrain rows to SEC-keyed datasets (EDGAR filings, financial statements,
222
+ 13F holdings) or to your own security master.
223
+
204
224
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
205
225
  date — a trade executed inside the window is returned even if it was disclosed
206
226
  after `date_to`.
@@ -164,15 +164,35 @@ kept as filed. A filing with no usable amount at all reports `amount` as
164
164
  column blank report `owner` as `UNKNOWN`; House filings that leave it blank
165
165
  report `SELF`, per the House PTR-form instructions.
166
166
 
167
- `disclosureDate` and `owner` are `null` on historical rows collected before
168
- the fields were captured upstream. With `as_dataframe=True`, `date` is the
169
- **index** and the other fields are columns whose missing values read as
170
- `None` or `NaN` depending on your pandas version — test them with
171
- `pandas.isna()` rather than `is None`. Note that `.dropna()` on such a frame
172
- will discard every row with any missing field — use `.dropna(subset=[...])`.
167
+ `disclosureDate` and `owner` are nullable. Historical rows were backfilled
168
+ in place by the pipeline's reconcile upload, so nulls are rare — but code
169
+ should still handle them. With `as_dataframe=True`, `date` is the **index**
170
+ and the other fields are columns whose missing values read as `None` or
171
+ `NaN` depending on your pandas version — test them with `pandas.isna()`
172
+ rather than `is None`. Note that `.dropna()` on such a frame will discard
173
+ every row with any missing field — use `.dropna(subset=[...])`.
173
174
  `disclosureDate` and `owner` are also present on
174
175
  `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
175
176
 
177
+ ### Company identifier (`cik`)
178
+
179
+ Rows from the four SEC/government datasets — `fb.insider_transactions`,
180
+ `fb.government_contracts`, `fb.corporate_lobbying`, and `fb.patent_filings`
181
+ (ticker endpoints and their async equivalents) — carry `cik`, the SEC
182
+ **Central Index Key** of the company as of that record:
183
+
184
+ | Field | Meaning |
185
+ | ----- | ------------------------------------------------------------------------------------------- |
186
+ | `cik` | SEC Central Index Key of the company, as a 10-digit zero-padded string (`"0000320193"`) |
187
+
188
+ `cik` is a **string, not a number** — the leading zeros are part of the
189
+ identifier, so keep the column as text when loading into other tools. Rows
190
+ without an entity resolution (for example, records of companies absent from
191
+ the SEC's public company file) carry `null`; with `as_dataframe=True` the
192
+ column stays object-typed and missing values read as `None`. Use it to join
193
+ FinBrain rows to SEC-keyed datasets (EDGAR filings, financial statements,
194
+ 13F holdings) or to your own security master.
195
+
176
196
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
177
197
  date — a trade executed inside the window is returned even if it was disclosed
178
198
  after `date_to`.
@@ -41,9 +41,9 @@ class AsyncHouseTradesAPI:
41
41
  bracket; ``amountFlag`` is ``"review"`` or ``"ambiguous"`` when the
42
42
  amount could not be safely normalized (``None`` otherwise).
43
43
 
44
- ``disclosureDate`` and ``owner`` are ``None`` for historical rows
45
- collected before the fields were captured (``NaN`` in the DataFrame
46
- branch on newer pandas — use ``pandas.isna``).
44
+ ``disclosureDate`` and ``owner`` are nullable; historical rows were
45
+ backfilled upstream, so missing values are rare but possible (``NaN``
46
+ in the DataFrame branch on newer pandas — use ``pandas.isna``).
47
47
 
48
48
  ``date_from``/``date_to`` bound the transaction date, not the
49
49
  disclosure date.
@@ -114,7 +114,8 @@ class AsyncScreenerAPI:
114
114
  ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
115
115
  account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, or an account
116
116
  code) and ``disclosureDate`` (the public disclosure date). ``owner``
117
- and ``disclosureDate`` are ``None`` on historical rows.
117
+ and ``disclosureDate`` are nullable, though rare — historical rows
118
+ were backfilled upstream.
118
119
  """
119
120
  params = self._build_params(limit=limit)
120
121
  return await self._get("screener/congress/house", params, as_dataframe)
@@ -135,7 +136,7 @@ class AsyncScreenerAPI:
135
136
  account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, an account code,
136
137
  or ``"UNKNOWN"`` for blank Senate filings) and ``disclosureDate``
137
138
  (the public disclosure date). ``owner`` and ``disclosureDate`` are
138
- ``None`` on historical rows.
139
+ nullable, though rare — historical rows were backfilled upstream.
139
140
  """
140
141
  params = self._build_params(limit=limit)
141
142
  return await self._get("screener/congress/senate", params, as_dataframe)
@@ -41,9 +41,9 @@ class AsyncSenateTradesAPI:
41
41
  bracket; ``amountFlag`` is ``"review"`` or ``"ambiguous"`` when the
42
42
  amount could not be safely normalized (``None`` otherwise).
43
43
 
44
- ``disclosureDate`` and ``owner`` are ``None`` for historical rows
45
- collected before the fields were captured (``NaN`` in the DataFrame
46
- branch on newer pandas — use ``pandas.isna``).
44
+ ``disclosureDate`` and ``owner`` are nullable; historical rows were
45
+ backfilled upstream, so missing values are rare but possible (``NaN``
46
+ in the DataFrame branch on newer pandas — use ``pandas.isna``).
47
47
 
48
48
  ``date_from``/``date_to`` bound the transaction date, not the
49
49
  disclosure date.
@@ -72,12 +72,12 @@ class HouseTradesAPI:
72
72
  or ``"ambiguous"``; on all other rows ``amountRaw`` and
73
73
  ``amountFlag`` are ``None``.
74
74
 
75
- ``disclosureDate`` and ``owner`` are ``None`` for historical
76
- rows collected before the fields were captured upstream. In the
77
- DataFrame branch ``date`` becomes the index and the remaining
78
- fields are columns whose missing values read as ``None`` or
79
- ``NaN`` depending on the pandas version — test them with
80
- :func:`pandas.isna`.
75
+ ``disclosureDate`` and ``owner`` are nullable; historical rows
76
+ were backfilled in place by the upstream pipeline, so missing
77
+ values are rare but possible. In the DataFrame branch ``date``
78
+ becomes the index and the remaining fields are columns whose
79
+ missing values read as ``None`` or ``NaN`` depending on the
80
+ pandas version — test them with :func:`pandas.isna`.
81
81
 
82
82
  Notes
83
83
  -----
@@ -119,7 +119,8 @@ class ScreenerAPI:
119
119
  ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
120
120
  account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, or an account
121
121
  code) and ``disclosureDate`` (the public disclosure date). ``owner``
122
- and ``disclosureDate`` are ``None`` on historical rows.
122
+ and ``disclosureDate`` are nullable, though rare — historical rows
123
+ were backfilled upstream.
123
124
  """
124
125
  params = self._build_params(limit=limit)
125
126
  return self._get("screener/congress/house", params, as_dataframe)
@@ -140,7 +141,7 @@ class ScreenerAPI:
140
141
  account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, an account code,
141
142
  or ``"UNKNOWN"`` for blank Senate filings) and ``disclosureDate``
142
143
  (the public disclosure date). ``owner`` and ``disclosureDate`` are
143
- ``None`` on historical rows.
144
+ nullable, though rare — historical rows were backfilled upstream.
144
145
  """
145
146
  params = self._build_params(limit=limit)
146
147
  return self._get("screener/congress/senate", params, as_dataframe)
@@ -71,12 +71,12 @@ class SenateTradesAPI:
71
71
  or ``"ambiguous"``; on all other rows ``amountRaw`` and
72
72
  ``amountFlag`` are ``None``.
73
73
 
74
- ``disclosureDate`` and ``owner`` are ``None`` for historical
75
- rows collected before the fields were captured upstream. In the
76
- DataFrame branch ``date`` becomes the index and the remaining
77
- fields are columns whose missing values read as ``None`` or
78
- ``NaN`` depending on the pandas version — test them with
79
- :func:`pandas.isna`.
74
+ ``disclosureDate`` and ``owner`` are nullable; historical rows
75
+ were backfilled in place by the upstream pipeline, so missing
76
+ values are rare but possible. In the DataFrame branch ``date``
77
+ becomes the index and the remaining fields are columns whose
78
+ missing values read as ``None`` or ``NaN`` depending on the
79
+ pandas version — test them with :func:`pandas.isna`.
80
80
 
81
81
  Notes
82
82
  -----
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: Official Python client for the FinBrain API
5
5
  Author-email: Ahmet Salim Bilgin <ahmet@finbrain.tech>
6
6
  License-Expression: MIT
@@ -192,15 +192,35 @@ kept as filed. A filing with no usable amount at all reports `amount` as
192
192
  column blank report `owner` as `UNKNOWN`; House filings that leave it blank
193
193
  report `SELF`, per the House PTR-form instructions.
194
194
 
195
- `disclosureDate` and `owner` are `null` on historical rows collected before
196
- the fields were captured upstream. With `as_dataframe=True`, `date` is the
197
- **index** and the other fields are columns whose missing values read as
198
- `None` or `NaN` depending on your pandas version — test them with
199
- `pandas.isna()` rather than `is None`. Note that `.dropna()` on such a frame
200
- will discard every row with any missing field — use `.dropna(subset=[...])`.
195
+ `disclosureDate` and `owner` are nullable. Historical rows were backfilled
196
+ in place by the pipeline's reconcile upload, so nulls are rare — but code
197
+ should still handle them. With `as_dataframe=True`, `date` is the **index**
198
+ and the other fields are columns whose missing values read as `None` or
199
+ `NaN` depending on your pandas version — test them with `pandas.isna()`
200
+ rather than `is None`. Note that `.dropna()` on such a frame will discard
201
+ every row with any missing field — use `.dropna(subset=[...])`.
201
202
  `disclosureDate` and `owner` are also present on
202
203
  `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
203
204
 
205
+ ### Company identifier (`cik`)
206
+
207
+ Rows from the four SEC/government datasets — `fb.insider_transactions`,
208
+ `fb.government_contracts`, `fb.corporate_lobbying`, and `fb.patent_filings`
209
+ (ticker endpoints and their async equivalents) — carry `cik`, the SEC
210
+ **Central Index Key** of the company as of that record:
211
+
212
+ | Field | Meaning |
213
+ | ----- | ------------------------------------------------------------------------------------------- |
214
+ | `cik` | SEC Central Index Key of the company, as a 10-digit zero-padded string (`"0000320193"`) |
215
+
216
+ `cik` is a **string, not a number** — the leading zeros are part of the
217
+ identifier, so keep the column as text when loading into other tools. Rows
218
+ without an entity resolution (for example, records of companies absent from
219
+ the SEC's public company file) carry `null`; with `as_dataframe=True` the
220
+ column stays object-typed and missing values read as `None`. Use it to join
221
+ FinBrain rows to SEC-keyed datasets (EDGAR filings, financial statements,
222
+ 13F holdings) or to your own security master.
223
+
204
224
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
205
225
  date — a trade executed inside the window is returned even if it was disclosed
206
226
  after `date_to`.
@@ -67,6 +67,7 @@ tests/test_analyst_ratings.py
67
67
  tests/test_app_ratings.py
68
68
  tests/test_async_client.py
69
69
  tests/test_available.py
70
+ tests/test_cik_passthrough.py
70
71
  tests/test_client.py
71
72
  tests/test_corporate_lobbying.py
72
73
  tests/test_envelope.py
@@ -1,85 +1,86 @@
1
1
  {
2
2
  "files": [
3
- "CHANGELOG.md",
4
3
  ".gitattributes",
5
- "pyproject.toml",
4
+ ".github/workflows/ci.yml",
5
+ ".github/workflows/release.yml",
6
+ ".gitignore",
7
+ "CHANGELOG.md",
6
8
  "LICENSE",
7
9
  "README.md",
8
10
  "RELEASE.md",
9
- ".gitignore",
10
- ".github/workflows/ci.yml",
11
- ".github/workflows/release.yml",
12
- "examples/transactions_plotting_example.py",
13
11
  "examples/async_example.py",
14
- "tests/test_available.py",
15
- "tests/test_async_client.py",
16
- "tests/test_insider_transactions.py",
17
- "tests/test_reddit_mentions.py",
18
- "tests/test_plotting.py",
19
- "tests/test_house_trades.py",
20
- "tests/test_sentiments.py",
21
- "tests/test_corporate_lobbying.py",
22
- "tests/test_options.py",
23
- "tests/test_envelope.py",
24
- "tests/__init__.py",
25
- "tests/test_patent_filings.py",
26
- "tests/test_integration.py",
27
- "tests/test_linkedin_data.py",
28
- "tests/test_client.py",
29
- "tests/test_app_ratings.py",
30
- "tests/test_recent.py",
31
- "tests/test_screener.py",
32
- "tests/test_news.py",
33
- "tests/conftest.py",
34
- "tests/test_utils.py",
35
- "tests/test_analyst_ratings.py",
36
- "tests/test_predictions.py",
37
- "tests/test_senate_trades.py",
38
- "tests/test_government_contracts.py",
39
- "src/finbrain/py.typed",
12
+ "examples/transactions_plotting_example.py",
13
+ "pyproject.toml",
40
14
  "src/finbrain/__init__.py",
41
- "src/finbrain/client.py",
42
- "src/finbrain/exceptions.py",
43
- "src/finbrain/plotting.py",
44
15
  "src/finbrain/aio/__init__.py",
45
16
  "src/finbrain/aio/client.py",
46
- "src/finbrain/aio/endpoints/app_ratings.py",
47
- "src/finbrain/aio/endpoints/available.py",
48
- "src/finbrain/aio/endpoints/predictions.py",
49
- "src/finbrain/aio/endpoints/corporate_lobbying.py",
50
- "src/finbrain/aio/endpoints/reddit_mentions.py",
51
17
  "src/finbrain/aio/endpoints/__init__.py",
52
- "src/finbrain/aio/endpoints/patent_filings.py",
53
- "src/finbrain/aio/endpoints/options.py",
54
- "src/finbrain/aio/endpoints/linkedin_data.py",
55
18
  "src/finbrain/aio/endpoints/_utils.py",
56
- "src/finbrain/aio/endpoints/senate_trades.py",
57
- "src/finbrain/aio/endpoints/insider_transactions.py",
58
19
  "src/finbrain/aio/endpoints/analyst_ratings.py",
20
+ "src/finbrain/aio/endpoints/app_ratings.py",
21
+ "src/finbrain/aio/endpoints/available.py",
22
+ "src/finbrain/aio/endpoints/corporate_lobbying.py",
23
+ "src/finbrain/aio/endpoints/government_contracts.py",
59
24
  "src/finbrain/aio/endpoints/house_trades.py",
25
+ "src/finbrain/aio/endpoints/insider_transactions.py",
26
+ "src/finbrain/aio/endpoints/linkedin_data.py",
60
27
  "src/finbrain/aio/endpoints/news.py",
61
- "src/finbrain/aio/endpoints/sentiments.py",
28
+ "src/finbrain/aio/endpoints/options.py",
29
+ "src/finbrain/aio/endpoints/patent_filings.py",
30
+ "src/finbrain/aio/endpoints/predictions.py",
62
31
  "src/finbrain/aio/endpoints/recent.py",
32
+ "src/finbrain/aio/endpoints/reddit_mentions.py",
63
33
  "src/finbrain/aio/endpoints/screener.py",
64
- "src/finbrain/aio/endpoints/government_contracts.py",
65
- "src/finbrain/endpoints/app_ratings.py",
66
- "src/finbrain/endpoints/available.py",
67
- "src/finbrain/endpoints/predictions.py",
68
- "src/finbrain/endpoints/corporate_lobbying.py",
69
- "src/finbrain/endpoints/reddit_mentions.py",
34
+ "src/finbrain/aio/endpoints/senate_trades.py",
35
+ "src/finbrain/aio/endpoints/sentiments.py",
36
+ "src/finbrain/client.py",
70
37
  "src/finbrain/endpoints/__init__.py",
71
- "src/finbrain/endpoints/patent_filings.py",
72
- "src/finbrain/endpoints/options.py",
73
- "src/finbrain/endpoints/linkedin_data.py",
74
38
  "src/finbrain/endpoints/_utils.py",
75
- "src/finbrain/endpoints/senate_trades.py",
76
- "src/finbrain/endpoints/insider_transactions.py",
77
39
  "src/finbrain/endpoints/analyst_ratings.py",
40
+ "src/finbrain/endpoints/app_ratings.py",
41
+ "src/finbrain/endpoints/available.py",
42
+ "src/finbrain/endpoints/corporate_lobbying.py",
43
+ "src/finbrain/endpoints/government_contracts.py",
78
44
  "src/finbrain/endpoints/house_trades.py",
45
+ "src/finbrain/endpoints/insider_transactions.py",
46
+ "src/finbrain/endpoints/linkedin_data.py",
79
47
  "src/finbrain/endpoints/news.py",
80
- "src/finbrain/endpoints/sentiments.py",
48
+ "src/finbrain/endpoints/options.py",
49
+ "src/finbrain/endpoints/patent_filings.py",
50
+ "src/finbrain/endpoints/predictions.py",
81
51
  "src/finbrain/endpoints/recent.py",
52
+ "src/finbrain/endpoints/reddit_mentions.py",
82
53
  "src/finbrain/endpoints/screener.py",
83
- "src/finbrain/endpoints/government_contracts.py"
54
+ "src/finbrain/endpoints/senate_trades.py",
55
+ "src/finbrain/endpoints/sentiments.py",
56
+ "src/finbrain/exceptions.py",
57
+ "src/finbrain/plotting.py",
58
+ "src/finbrain/py.typed",
59
+ "tests/__init__.py",
60
+ "tests/conftest.py",
61
+ "tests/test_analyst_ratings.py",
62
+ "tests/test_app_ratings.py",
63
+ "tests/test_async_client.py",
64
+ "tests/test_available.py",
65
+ "tests/test_cik_passthrough.py",
66
+ "tests/test_client.py",
67
+ "tests/test_corporate_lobbying.py",
68
+ "tests/test_envelope.py",
69
+ "tests/test_government_contracts.py",
70
+ "tests/test_house_trades.py",
71
+ "tests/test_insider_transactions.py",
72
+ "tests/test_integration.py",
73
+ "tests/test_linkedin_data.py",
74
+ "tests/test_news.py",
75
+ "tests/test_options.py",
76
+ "tests/test_patent_filings.py",
77
+ "tests/test_plotting.py",
78
+ "tests/test_predictions.py",
79
+ "tests/test_recent.py",
80
+ "tests/test_reddit_mentions.py",
81
+ "tests/test_screener.py",
82
+ "tests/test_senate_trades.py",
83
+ "tests/test_sentiments.py",
84
+ "tests/test_utils.py"
84
85
  ]
85
86
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.2.9",
3
+ "distance": 0,
4
+ "node": "gb5e96b9408f1cd7098177b9b13f2d5e28696722b",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-08-14"
8
+ }
@@ -0,0 +1,160 @@
1
+ # tests/test_cik_passthrough.py
2
+ """The four CIK-carrying datasets pass `cik` through untouched.
3
+
4
+ The SDK deliberately does not pin row fields, so `cik` (added to the v2 API
5
+ 2026-08-14) must appear in both the raw-dict and DataFrame branches with no
6
+ SDK code changes. These tests pin that passthrough so a future refactor that
7
+ starts whitelisting columns fails loudly. `cik` is a 10-digit zero-padded
8
+ STRING (leading zeros are data); rows without an entity resolution carry null.
9
+ """
10
+ import pandas as pd
11
+
12
+ from .conftest import stub_json, wrap_v2
13
+
14
+ CIK_AAPL = "0000320193"
15
+
16
+
17
+ def _one_row_payload(kind):
18
+ if kind == "insider":
19
+ return "insider-trading/AAPL", wrap_v2({
20
+ "symbol": "AAPL",
21
+ "name": "Apple Inc.",
22
+ "transactions": [
23
+ {
24
+ "date": "2026-06-15",
25
+ "insider": "Jane Doe",
26
+ "relationship": "CFO",
27
+ "transactionType": "Sale",
28
+ "shares": 100,
29
+ "pricePerShare": 200.0,
30
+ "totalValue": 20000,
31
+ "sharesOwned": 5000,
32
+ "filingDate": "2026-06-17",
33
+ "filingUrl": "https://www.sec.gov/x",
34
+ "cik": CIK_AAPL,
35
+ },
36
+ {
37
+ "date": "2015-02-02",
38
+ "insider": "Old Filer",
39
+ "relationship": "Director",
40
+ "transactionType": "Sale",
41
+ "shares": 10,
42
+ "pricePerShare": 100.0,
43
+ "totalValue": 1000,
44
+ "sharesOwned": 50,
45
+ "filingDate": "2015-02-04",
46
+ "filingUrl": "https://www.sec.gov/y",
47
+ "cik": None,
48
+ },
49
+ ],
50
+ }), "transactions"
51
+ if kind == "contracts":
52
+ return "government-contracts/AAPL", wrap_v2({
53
+ "symbol": "AAPL",
54
+ "name": "Apple Inc.",
55
+ "contracts": [
56
+ {
57
+ "awardId": "AWD1",
58
+ "awardAmount": 1.0,
59
+ "awardType": "A",
60
+ "awardingAgency": "GSA",
61
+ "awardingSubAgency": "",
62
+ "recipientName": "APPLE INC",
63
+ "startDate": "2024-01-01",
64
+ "endDate": "2024-12-31",
65
+ "description": "",
66
+ "naicsCode": "",
67
+ "naicsDescription": "",
68
+ "contractAwardType": "",
69
+ "cik": CIK_AAPL,
70
+ }
71
+ ],
72
+ }), "contracts"
73
+ if kind == "lobbying":
74
+ return "lobbying/AAPL", wrap_v2({
75
+ "symbol": "AAPL",
76
+ "name": "Apple Inc.",
77
+ "filings": [
78
+ {
79
+ "date": "2026-01-21",
80
+ "filingUuid": "00000000-0000-0000-0000-000000000001",
81
+ "filingYear": 2025,
82
+ "quarter": "Q4",
83
+ "clientName": "Apple Inc.",
84
+ "registrantName": "Firm LLP",
85
+ "income": 0,
86
+ "expenses": 100000,
87
+ "issueCodes": ["TEC"],
88
+ "governmentEntities": ["SENATE"],
89
+ "cik": CIK_AAPL,
90
+ }
91
+ ],
92
+ }), "filings"
93
+ return "patent-filings/AAPL", wrap_v2({
94
+ "symbol": "AAPL",
95
+ "name": "Apple Inc.",
96
+ "patents": [
97
+ {
98
+ "patentId": "12345678",
99
+ "patentDate": "2026-08-11",
100
+ "title": "Widget",
101
+ "type": "utility",
102
+ "kind": "B2",
103
+ "numClaims": 20,
104
+ "numCitedBy": 0,
105
+ "assigneeOrganization": "Apple Inc.",
106
+ "assigneeType": "2",
107
+ "applicationFilingDate": "2024-01-01",
108
+ "filingToGrantDays": 953,
109
+ "inventors": ["A B"],
110
+ "numInventors": 1,
111
+ "cpcSections": ["G"],
112
+ "cpcSubsections": ["G06"],
113
+ "primaryCpcSection": "G",
114
+ "cik": CIK_AAPL,
115
+ }
116
+ ],
117
+ }), "patents"
118
+
119
+
120
+ def test_insider_cik_raw_and_null(client, _activate_responses):
121
+ path, payload, key = _one_row_payload("insider")
122
+ stub_json(_activate_responses, "GET", path, payload)
123
+ data = client.insider_transactions.ticker(symbol="AAPL")
124
+ rows = data[key]
125
+ assert rows[0]["cik"] == CIK_AAPL # string, leading zeros intact
126
+ assert rows[1]["cik"] is None # honest blank passes through as null
127
+
128
+
129
+ def test_insider_cik_dataframe(client, _activate_responses):
130
+ path, payload, key = _one_row_payload("insider")
131
+ stub_json(_activate_responses, "GET", path, payload)
132
+ df = client.insider_transactions.ticker(symbol="AAPL", as_dataframe=True)
133
+ assert "cik" in df.columns
134
+ assert df["cik"].iloc[0] == CIK_AAPL
135
+
136
+
137
+ def test_contracts_cik_raw(client, _activate_responses):
138
+ path, payload, key = _one_row_payload("contracts")
139
+ stub_json(_activate_responses, "GET", path, payload)
140
+ data = client.government_contracts.ticker(symbol="AAPL")
141
+ assert data[key][0]["cik"] == CIK_AAPL
142
+
143
+
144
+ def test_lobbying_cik_raw(client, _activate_responses):
145
+ path, payload, key = _one_row_payload("lobbying")
146
+ stub_json(_activate_responses, "GET", path, payload)
147
+ data = client.corporate_lobbying.ticker(symbol="AAPL")
148
+ assert data[key][0]["cik"] == CIK_AAPL
149
+
150
+
151
+ def test_patents_cik_dataframe(client, _activate_responses):
152
+ path, payload, key = _one_row_payload("patents")
153
+ stub_json(_activate_responses, "GET", path, payload)
154
+ df = client.patent_filings.ticker(symbol="AAPL", as_dataframe=True)
155
+ assert "cik" in df.columns
156
+ # The invariant is "never numerically coerced": the value keeps its
157
+ # leading zeros and the dtype is non-numeric. (Object dtype on pandas 2,
158
+ # the dedicated str dtype on pandas 3 — both are fine.)
159
+ assert df["cik"].iloc[0] == CIK_AAPL
160
+ assert not pd.api.types.is_numeric_dtype(df["cik"])
@@ -101,7 +101,7 @@ def test_house_trades_dataframe_ok(client, _activate_responses):
101
101
  # placeholder and carries a review flag.
102
102
  assert df.loc["2024-01-10", "amount"] == "Unknown"
103
103
  assert df.loc["2024-01-10", "amountFlag"] == "review"
104
- # Historical rows predate the disclosure-date and owner fields; JSON null
104
+ # Nullable fields (rows a reconcile upload could not fill); JSON null
105
105
  # becomes NaN once pandas builds the column.
106
106
  assert pd.isna(df.loc["2024-01-10", "disclosureDate"])
107
107
  assert pd.isna(df.loc["2024-01-10", "owner"])
@@ -230,8 +230,8 @@ class TestHouseTrades:
230
230
  assert "date" in trades[0]
231
231
  assert "politician" in trades[0]
232
232
  assert "transactionType" in trades[0]
233
- # Present on every row; null on rows collected before the
234
- # fields were added to the pipeline.
233
+ # Present on every row; nullable, though historical rows were
234
+ # backfilled upstream so nulls are rare.
235
235
  assert "disclosureDate" in trades[0]
236
236
  assert "owner" in trades[0]
237
237
  # Amount normalization metadata: null unless the filed amount
@@ -246,8 +246,8 @@ class TestHouseTrades:
246
246
  if len(df) > 0:
247
247
  assert df.index.name == "date"
248
248
  assert "politician" in df.columns
249
- # Survive the DataFrame conversion as columns (values may be
250
- # null on rows predating the upstream fields).
249
+ # Survive the DataFrame conversion as columns (values are
250
+ # nullable, so missing entries read as NaN).
251
251
  assert "disclosureDate" in df.columns
252
252
  assert "owner" in df.columns
253
253
  assert "amountRaw" in df.columns
@@ -267,8 +267,8 @@ class TestSenateTrades:
267
267
  if len(trades) > 0:
268
268
  assert "date" in trades[0]
269
269
  assert "politician" in trades[0]
270
- # Present on every row; null on rows collected before the
271
- # fields were added to the pipeline.
270
+ # Present on every row; nullable, though historical rows were
271
+ # backfilled upstream so nulls are rare.
272
272
  assert "disclosureDate" in trades[0]
273
273
  assert "owner" in trades[0]
274
274
  # Amount normalization metadata: null unless the filed amount
@@ -283,8 +283,8 @@ class TestSenateTrades:
283
283
  if len(df) > 0:
284
284
  assert df.index.name == "date"
285
285
  assert "politician" in df.columns
286
- # Survive the DataFrame conversion as columns (values may be
287
- # null on rows predating the upstream fields).
286
+ # Survive the DataFrame conversion as columns (values are
287
+ # nullable, so missing entries read as NaN).
288
288
  assert "disclosureDate" in df.columns
289
289
  assert "owner" in df.columns
290
290
  assert "amountRaw" in df.columns
@@ -138,7 +138,7 @@ def test_screener_congress_house_dataframe(client, _activate_responses):
138
138
  assert df.loc["AAPL", "politician"] == "Nancy Pelosi"
139
139
  assert df.loc["AAPL", "owner"] == "SP"
140
140
  assert df.loc["AAPL", "disclosureDate"] == "2026-02-05"
141
- # Historical rows predate the disclosure-date and owner fields; JSON null
141
+ # Nullable fields (rows a reconcile upload could not fill); JSON null
142
142
  # becomes NaN once pandas builds the column.
143
143
  assert pd.isna(df.loc["MSFT", "disclosureDate"])
144
144
  assert pd.isna(df.loc["MSFT", "owner"])
@@ -190,7 +190,7 @@ def test_screener_congress_senate_dataframe(client, _activate_responses):
190
190
  assert df.loc["NVDA", "politician"] == "Tommy Tuberville"
191
191
  assert df.loc["AAPL", "owner"] == "SELF"
192
192
  assert df.loc["AAPL", "disclosureDate"] == "2026-01-22"
193
- # Historical rows predate the disclosure-date and owner fields; JSON null
193
+ # Nullable fields (rows a reconcile upload could not fill); JSON null
194
194
  # becomes NaN once pandas builds the column.
195
195
  assert pd.isna(df.loc["NVDA", "disclosureDate"])
196
196
  assert pd.isna(df.loc["NVDA", "owner"])
@@ -99,7 +99,7 @@ def test_senate_trades_dataframe_ok(client, _activate_responses):
99
99
  assert df.loc["2024-01-15", "owner"] == "SELF"
100
100
  # A flagged amount keeps the raw filed string in `amount`.
101
101
  assert df.loc["2024-01-08", "amountFlag"] == "ambiguous"
102
- # Historical rows predate the disclosure-date and owner fields; JSON null
102
+ # Nullable fields (rows a reconcile upload could not fill); JSON null
103
103
  # becomes NaN once pandas builds the column.
104
104
  assert pd.isna(df.loc["2024-01-08", "disclosureDate"])
105
105
  assert pd.isna(df.loc["2024-01-08", "owner"])
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.2.8",
3
- "distance": 0,
4
- "node": "g76893e8308ef568a8b2a76bb81a2d3060f1766a4",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-07-28"
8
- }
File without changes