finbrain-python 0.2.6__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/.github/workflows/ci.yml +4 -1
  2. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/.github/workflows/release.yml +22 -0
  3. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/CHANGELOG.md +25 -0
  4. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/PKG-INFO +36 -11
  5. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/README.md +35 -10
  6. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/pyproject.toml +19 -0
  7. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/house_trades.py +16 -5
  8. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/screener.py +9 -4
  9. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/senate_trades.py +16 -5
  10. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/house_trades.py +29 -10
  11. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/screener.py +9 -4
  12. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/senate_trades.py +28 -10
  13. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/PKG-INFO +36 -11
  14. finbrain_python-0.2.8/src/finbrain_python.egg-info/scm_version.json +8 -0
  15. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_house_trades.py +26 -3
  16. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_integration.py +26 -6
  17. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_screener.py +18 -6
  18. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_senate_trades.py +25 -4
  19. finbrain_python-0.2.6/src/finbrain_python.egg-info/scm_version.json +0 -8
  20. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/.gitattributes +0 -0
  21. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/.gitignore +0 -0
  22. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/LICENSE +0 -0
  23. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/RELEASE.md +0 -0
  24. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/examples/async_example.py +0 -0
  25. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/examples/transactions_plotting_example.py +0 -0
  26. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/setup.cfg +0 -0
  27. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/__init__.py +0 -0
  28. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/__init__.py +0 -0
  29. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/client.py +0 -0
  30. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/__init__.py +0 -0
  31. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/_utils.py +0 -0
  32. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/analyst_ratings.py +0 -0
  33. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/app_ratings.py +0 -0
  34. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/available.py +0 -0
  35. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/corporate_lobbying.py +0 -0
  36. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/government_contracts.py +0 -0
  37. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/insider_transactions.py +0 -0
  38. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/linkedin_data.py +0 -0
  39. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/news.py +0 -0
  40. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/options.py +0 -0
  41. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/patent_filings.py +0 -0
  42. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/predictions.py +0 -0
  43. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/recent.py +0 -0
  44. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/reddit_mentions.py +0 -0
  45. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/aio/endpoints/sentiments.py +0 -0
  46. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/client.py +0 -0
  47. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/__init__.py +0 -0
  48. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/_utils.py +0 -0
  49. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/analyst_ratings.py +0 -0
  50. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/app_ratings.py +0 -0
  51. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/available.py +0 -0
  52. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/corporate_lobbying.py +0 -0
  53. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/government_contracts.py +0 -0
  54. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/insider_transactions.py +0 -0
  55. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/linkedin_data.py +0 -0
  56. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/news.py +0 -0
  57. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/options.py +0 -0
  58. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/patent_filings.py +0 -0
  59. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/predictions.py +0 -0
  60. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/recent.py +0 -0
  61. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/reddit_mentions.py +0 -0
  62. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/endpoints/sentiments.py +0 -0
  63. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/exceptions.py +0 -0
  64. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/plotting.py +0 -0
  65. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain/py.typed +0 -0
  66. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/SOURCES.txt +0 -0
  67. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/dependency_links.txt +0 -0
  68. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/requires.txt +0 -0
  69. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/scm_file_list.json +0 -0
  70. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/src/finbrain_python.egg-info/top_level.txt +0 -0
  71. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/__init__.py +0 -0
  72. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/conftest.py +0 -0
  73. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_analyst_ratings.py +0 -0
  74. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_app_ratings.py +0 -0
  75. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_async_client.py +0 -0
  76. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_available.py +0 -0
  77. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_client.py +0 -0
  78. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_corporate_lobbying.py +0 -0
  79. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_envelope.py +0 -0
  80. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_government_contracts.py +0 -0
  81. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_insider_transactions.py +0 -0
  82. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_linkedin_data.py +0 -0
  83. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_news.py +0 -0
  84. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_options.py +0 -0
  85. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_patent_filings.py +0 -0
  86. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_plotting.py +0 -0
  87. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_predictions.py +0 -0
  88. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_recent.py +0 -0
  89. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_reddit_mentions.py +0 -0
  90. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_sentiments.py +0 -0
  91. {finbrain_python-0.2.6 → finbrain_python-0.2.8}/tests/test_utils.py +0 -0
@@ -1,6 +1,9 @@
1
1
  name: CI
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches: ['**'] # tags are covered by the gate in release.yml
6
+ pull_request:
4
7
 
5
8
  jobs:
6
9
  test:
@@ -5,7 +5,29 @@ on:
5
5
  tags: ['v[0-9]*'] # e.g. v0.1.0, v1.2.3
6
6
 
7
7
  jobs:
8
+ # Gate the upload on the tagged commit actually passing. The publish job
9
+ # previously ran straight off the tag push with no dependency on CI, so a
10
+ # commit with failing checks could still reach PyPI -- and PyPI versions are
11
+ # immutable, so a bad upload cannot be replaced, only superseded.
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python }}
24
+ - run: pip install -e .[dev]
25
+ - run: ruff check .
26
+ - run: mypy
27
+ - run: pytest -q
28
+
8
29
  build:
30
+ needs: test
9
31
  runs-on: ubuntu-latest
10
32
 
11
33
  steps:
@@ -5,6 +5,31 @@ 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.8] - 2026-07-28
9
+
10
+ ### Added
11
+
12
+ - **Congressional account owner**: House and Senate trade rows now carry `owner` — the beneficial owner of the traded account: `SELF`, `SP` (spouse), `DC` (dependent child), `JT` (joint), or an account code. Senate filings that leave the owner column blank report `UNKNOWN`; House filings that leave it blank report `SELF`, per the House PTR-form instructions. Available on `fb.house_trades.ticker()`, `fb.senate_trades.ticker()`, their async equivalents, and the `fb.screener.congress_house()` / `fb.screener.congress_senate()` rows
13
+ - **Congressional amount normalization metadata**: ticker-level trade rows also carry `amountRaw` and `amountFlag`. `amount` is now normalized to the ten statutory STOCK Act brackets whenever the filed string is an unambiguous formatting variant of one (open-ended categories like `Over $1,000,000` are kept as filed); on normalized rows `amountRaw` preserves the string as originally filed. When the filed amount could not be safely normalized, `amount` keeps the raw filed string (or `Unknown` when the filing had no usable amount) and `amountFlag` is `review` or `ambiguous`; on all other rows both fields are `null`
14
+ - **Documentation**: README "Congressional trade fields" section covering the new fields, and expanded docstrings on the sync/async ticker and screener methods
15
+ - **Tests**: Unit tests assert the new fields pass through in both the raw-dict and DataFrame branches, including the null cases; integration tests assert the keys are present on live responses
16
+
17
+ ### Changed
18
+
19
+ - **DataFrame shape**: `fb.house_trades.ticker(..., as_dataframe=True)` and `fb.senate_trades.ticker(..., as_dataframe=True)` gain `owner`, `amountRaw` and `amountFlag` columns; the congress screener frames gain an `owner` column. Code that asserts an exact column set (`set(df.columns) == {...}`) or compares frames for equality needs updating
20
+
21
+ ### Notes
22
+
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
24
+ - The raw-dict branch is purely additive — no call-site changes are required to receive the new fields
25
+
26
+ ## [0.2.7] - 2026-07-24
27
+
28
+ ### Changed
29
+
30
+ - **Tooling**: pinned the ruff rule set to `E4`/`E7`/`E9`/`F` in `[tool.ruff.lint]`. `ruff check .` previously ran with no ruff configuration, so it followed whatever ruff's current defaults were; 0.16.0 widened that selection and turned CI red with 455 findings in unchanged code. These four groups are ruff's long-standing defaults, so enforcement is unchanged — it just no longer moves when ruff releases
31
+ - **Tooling**: mypy no longer follows numpy's stubs. numpy ships inline stubs using PEP 695 `type` statements, which mypy only parses when both its target `python_version` and the interpreter it runs under are 3.12+, so a numpy release aborted the entire run on the lower matrix jobs. Raising `python_version` alone does not fix this — it clears the target check but not the interpreter one. `python_version` stays at `3.10`, so the 3.9 target is still exercised, and no public API surfaces numpy types
32
+
8
33
  ## [0.2.6] - 2026-07-24
9
34
 
10
35
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.2.6
3
+ Version: 0.2.8
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
@@ -84,7 +84,8 @@ fb.analyst_ratings.ticker("AMZN",
84
84
  as_dataframe=True)
85
85
 
86
86
  # ---------- house trades ----------
87
- # Rows include `disclosureDate` alongside the transaction `date`.
87
+ # Rows include `disclosureDate`, `owner`, `amountRaw` and `amountFlag`
88
+ # alongside the transaction `date` — see "Congressional trade fields" below.
88
89
  fb.house_trades.ticker("AMZN",
89
90
  date_from="2025-01-01",
90
91
  date_to="2025-06-30",
@@ -156,7 +157,7 @@ fb.screener.insider_trading(limit=50)
156
157
  fb.screener.reddit_mentions(limit=100, as_dataframe=True)
157
158
  fb.screener.government_contracts(limit=100, as_dataframe=True)
158
159
  fb.screener.patent_filings(limit=100, as_dataframe=True)
159
- fb.screener.congress_house(limit=50) # rows carry `disclosureDate`
160
+ fb.screener.congress_house(limit=50) # rows carry `disclosureDate` and `owner`
160
161
  fb.screener.congress_senate(limit=50)
161
162
 
162
163
  # ---------- recent data ----------
@@ -164,7 +165,7 @@ fb.recent.news(limit=100, as_dataframe=True)
164
165
  fb.recent.analyst_ratings(limit=50)
165
166
  ```
166
167
 
167
- ### Congressional trade dates
168
+ ### Congressional trade fields
168
169
 
169
170
  House and Senate trade rows carry **two** dates, and the gap between them is
170
171
  the reporting lag — often weeks:
@@ -174,13 +175,31 @@ the reporting lag — often weeks:
174
175
  | `date` | Transaction date — when the member actually bought or sold |
175
176
  | `disclosureDate` | Public disclosure date — when the periodic transaction report ran |
176
177
 
177
- `disclosureDate` is `null` on historical rows collected before the field was
178
- captured upstream. With `as_dataframe=True`, `date` is the **index** and
179
- `disclosureDate` is a column whose missing values read as `None` or `NaN`
180
- depending on your pandas version — test them with `pandas.isna()` rather than
181
- `is None`. Note that `.dropna()` on such a frame will now discard every
182
- historical row. The same field is present on `fb.screener.congress_house()`
183
- and `fb.screener.congress_senate()` rows.
178
+ Rows also identify **whose account** traded and how the filed amount was
179
+ normalized:
180
+
181
+ | Field | Meaning |
182
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
183
+ | `owner` | Beneficial owner of the account: `SELF`, `SP` (spouse), `DC` (dependent child), `JT` (joint), or an account code |
184
+ | `amountRaw` | The amount string as originally filed — set only when `amount` was rewritten to the canonical STOCK Act bracket, `null` otherwise |
185
+ | `amountFlag` | `null` on clean rows; `review` or `ambiguous` when the filed amount could not be safely normalized (then `amount` keeps the raw string as filed) |
186
+
187
+ `amount` is normalized to the ten statutory STOCK Act brackets (e.g.
188
+ `"$1,001 - $15,000"`) whenever the filed string is an unambiguous formatting
189
+ variant of one; open-ended filing categories like `"Over $1,000,000"` are
190
+ kept as filed. A filing with no usable amount at all reports `amount` as
191
+ `"Unknown"` with `amountFlag` = `review`. Senate filings that leave the owner
192
+ column blank report `owner` as `UNKNOWN`; House filings that leave it blank
193
+ report `SELF`, per the House PTR-form instructions.
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=[...])`.
201
+ `disclosureDate` and `owner` are also present on
202
+ `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
184
203
 
185
204
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
186
205
  date — a trade executed inside the window is returned even if it was disclosed
@@ -193,6 +212,12 @@ lag_days = [
193
212
  for t in trades
194
213
  if t["disclosureDate"]
195
214
  ]
215
+
216
+ # Only the member's own trades, skipping flagged amounts
217
+ own = [
218
+ t for t in trades
219
+ if t["owner"] == "SELF" and t["amountFlag"] is None
220
+ ]
196
221
  ```
197
222
 
198
223
  ## ⚡ Async Usage
@@ -56,7 +56,8 @@ fb.analyst_ratings.ticker("AMZN",
56
56
  as_dataframe=True)
57
57
 
58
58
  # ---------- house trades ----------
59
- # Rows include `disclosureDate` alongside the transaction `date`.
59
+ # Rows include `disclosureDate`, `owner`, `amountRaw` and `amountFlag`
60
+ # alongside the transaction `date` — see "Congressional trade fields" below.
60
61
  fb.house_trades.ticker("AMZN",
61
62
  date_from="2025-01-01",
62
63
  date_to="2025-06-30",
@@ -128,7 +129,7 @@ fb.screener.insider_trading(limit=50)
128
129
  fb.screener.reddit_mentions(limit=100, as_dataframe=True)
129
130
  fb.screener.government_contracts(limit=100, as_dataframe=True)
130
131
  fb.screener.patent_filings(limit=100, as_dataframe=True)
131
- fb.screener.congress_house(limit=50) # rows carry `disclosureDate`
132
+ fb.screener.congress_house(limit=50) # rows carry `disclosureDate` and `owner`
132
133
  fb.screener.congress_senate(limit=50)
133
134
 
134
135
  # ---------- recent data ----------
@@ -136,7 +137,7 @@ fb.recent.news(limit=100, as_dataframe=True)
136
137
  fb.recent.analyst_ratings(limit=50)
137
138
  ```
138
139
 
139
- ### Congressional trade dates
140
+ ### Congressional trade fields
140
141
 
141
142
  House and Senate trade rows carry **two** dates, and the gap between them is
142
143
  the reporting lag — often weeks:
@@ -146,13 +147,31 @@ the reporting lag — often weeks:
146
147
  | `date` | Transaction date — when the member actually bought or sold |
147
148
  | `disclosureDate` | Public disclosure date — when the periodic transaction report ran |
148
149
 
149
- `disclosureDate` is `null` on historical rows collected before the field was
150
- captured upstream. With `as_dataframe=True`, `date` is the **index** and
151
- `disclosureDate` is a column whose missing values read as `None` or `NaN`
152
- depending on your pandas version — test them with `pandas.isna()` rather than
153
- `is None`. Note that `.dropna()` on such a frame will now discard every
154
- historical row. The same field is present on `fb.screener.congress_house()`
155
- and `fb.screener.congress_senate()` rows.
150
+ Rows also identify **whose account** traded and how the filed amount was
151
+ normalized:
152
+
153
+ | Field | Meaning |
154
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
155
+ | `owner` | Beneficial owner of the account: `SELF`, `SP` (spouse), `DC` (dependent child), `JT` (joint), or an account code |
156
+ | `amountRaw` | The amount string as originally filed — set only when `amount` was rewritten to the canonical STOCK Act bracket, `null` otherwise |
157
+ | `amountFlag` | `null` on clean rows; `review` or `ambiguous` when the filed amount could not be safely normalized (then `amount` keeps the raw string as filed) |
158
+
159
+ `amount` is normalized to the ten statutory STOCK Act brackets (e.g.
160
+ `"$1,001 - $15,000"`) whenever the filed string is an unambiguous formatting
161
+ variant of one; open-ended filing categories like `"Over $1,000,000"` are
162
+ kept as filed. A filing with no usable amount at all reports `amount` as
163
+ `"Unknown"` with `amountFlag` = `review`. Senate filings that leave the owner
164
+ column blank report `owner` as `UNKNOWN`; House filings that leave it blank
165
+ report `SELF`, per the House PTR-form instructions.
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=[...])`.
173
+ `disclosureDate` and `owner` are also present on
174
+ `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
156
175
 
157
176
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
158
177
  date — a trade executed inside the window is returned even if it was disclosed
@@ -165,6 +184,12 @@ lag_days = [
165
184
  for t in trades
166
185
  if t["disclosureDate"]
167
186
  ]
187
+
188
+ # Only the member's own trades, skipping flagged amounts
189
+ own = [
190
+ t for t in trades
191
+ if t["owner"] == "SELF" and t["amountFlag"] is None
192
+ ]
168
193
  ```
169
194
 
170
195
  ## ⚡ Async Usage
@@ -60,3 +60,22 @@ markers = [
60
60
  python_version = "3.10"
61
61
  files = ["src/finbrain"]
62
62
  ignore_missing_imports = true # third-party libs (pandas, plotly, …) ship no stubs here
63
+
64
+ # numpy ships inline stubs that use PEP 695 `type` statements. mypy refuses to
65
+ # parse those unless BOTH its target `python_version` and the interpreter it is
66
+ # running under are 3.12+, so a numpy release can abort the whole run ("Type
67
+ # statement is only supported in Python 3.12 and greater") on any matrix job
68
+ # below 3.12 -- with no change to this codebase. Nothing in the public API
69
+ # surfaces numpy types, so skip its stubs rather than chasing numpy's baseline.
70
+ [[tool.mypy.overrides]]
71
+ module = ["numpy.*"]
72
+ follow_imports = "skip"
73
+ follow_imports_for_stubs = true
74
+
75
+ [tool.ruff.lint]
76
+ # Pin the rule set explicitly. `ruff check .` otherwise follows whatever ruff's
77
+ # current defaults happen to be, so a new ruff release can turn CI red with no
78
+ # code change (0.16.0 widened the defaults and surfaced hundreds of findings in
79
+ # code that had been passing). These four are ruff's long-standing defaults, so
80
+ # this preserves existing behaviour rather than changing it.
81
+ select = ["E4", "E7", "E9", "F"]
@@ -28,11 +28,22 @@ class AsyncHouseTradesAPI:
28
28
  Fetch House-member trades for a symbol (async).
29
29
 
30
30
  Each row in ``trades`` carries ``date`` (the transaction date),
31
- ``politician``, ``transactionType``, ``amount`` and
32
- ``disclosureDate`` — the date the trade was publicly disclosed in the
33
- member's periodic transaction report. ``disclosureDate`` is ``None``
34
- for historical rows collected before the field was captured (``NaN``
35
- in the DataFrame branch on newer pandas — use ``pandas.isna``).
31
+ ``politician``, ``transactionType``, ``amount``, ``owner``,
32
+ ``amountRaw``, ``amountFlag`` and ``disclosureDate`` — the date the
33
+ trade was publicly disclosed in the member's periodic transaction
34
+ report.
35
+
36
+ ``owner`` is the beneficial owner of the traded account: ``"SELF"``,
37
+ ``"SP"`` (spouse), ``"DC"`` (dependent child), ``"JT"`` (joint), or
38
+ an account code; House filings that leave the owner column blank
39
+ report as ``"SELF"``. ``amountRaw`` preserves the originally filed
40
+ amount string on rows whose ``amount`` was normalized to a STOCK Act
41
+ bracket; ``amountFlag`` is ``"review"`` or ``"ambiguous"`` when the
42
+ amount could not be safely normalized (``None`` otherwise).
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``).
36
47
 
37
48
  ``date_from``/``date_to`` bound the transaction date, not the
38
49
  disclosure date.
@@ -111,8 +111,10 @@ class AsyncScreenerAPI:
111
111
  Screen House trades across all tickers.
112
112
 
113
113
  Rows carry ``symbol``, ``name``, ``date``, ``politician``,
114
- ``transactionType``, ``amount`` and ``disclosureDate`` (the public
115
- disclosure date, ``None`` on historical rows).
114
+ ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
115
+ account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, or an account
116
+ code) and ``disclosureDate`` (the public disclosure date). ``owner``
117
+ and ``disclosureDate`` are ``None`` on historical rows.
116
118
  """
117
119
  params = self._build_params(limit=limit)
118
120
  return await self._get("screener/congress/house", params, as_dataframe)
@@ -129,8 +131,11 @@ class AsyncScreenerAPI:
129
131
  Screen Senate trades across all tickers.
130
132
 
131
133
  Rows carry ``symbol``, ``name``, ``date``, ``politician``,
132
- ``transactionType``, ``amount`` and ``disclosureDate`` (the public
133
- disclosure date, ``None`` on historical rows).
134
+ ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
135
+ account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, an account code,
136
+ or ``"UNKNOWN"`` for blank Senate filings) and ``disclosureDate``
137
+ (the public disclosure date). ``owner`` and ``disclosureDate`` are
138
+ ``None`` on historical rows.
134
139
  """
135
140
  params = self._build_params(limit=limit)
136
141
  return await self._get("screener/congress/senate", params, as_dataframe)
@@ -28,11 +28,22 @@ class AsyncSenateTradesAPI:
28
28
  Fetch Senate-member trades for a symbol (async).
29
29
 
30
30
  Each row in ``trades`` carries ``date`` (the transaction date),
31
- ``politician``, ``transactionType``, ``amount`` and
32
- ``disclosureDate`` — the date the trade was publicly disclosed in the
33
- member's periodic transaction report. ``disclosureDate`` is ``None``
34
- for historical rows collected before the field was captured (``NaN``
35
- in the DataFrame branch on newer pandas — use ``pandas.isna``).
31
+ ``politician``, ``transactionType``, ``amount``, ``owner``,
32
+ ``amountRaw``, ``amountFlag`` and ``disclosureDate`` — the date the
33
+ trade was publicly disclosed in the member's periodic transaction
34
+ report.
35
+
36
+ ``owner`` is the beneficial owner of the traded account: ``"SELF"``,
37
+ ``"SP"`` (spouse), ``"DC"`` (dependent child), ``"JT"`` (joint), an
38
+ account code, or ``"UNKNOWN"`` when the Senate filing left the owner
39
+ column blank. ``amountRaw`` preserves the originally filed amount
40
+ string on rows whose ``amount`` was normalized to a STOCK Act
41
+ bracket; ``amountFlag`` is ``"review"`` or ``"ambiguous"`` when the
42
+ amount could not be safely normalized (``None`` otherwise).
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``).
36
47
 
37
48
  ``date_from``/``date_to`` bound the transaction date, not the
38
49
  disclosure date.
@@ -51,15 +51,33 @@ class HouseTradesAPI:
51
51
  dict | pandas.DataFrame
52
52
  The raw dict has a ``trades`` list whose rows carry ``date``
53
53
  (the transaction date), ``politician``, ``transactionType``,
54
- ``amount`` and ``disclosureDate`` — the date the trade was
55
- publicly disclosed in the member's periodic transaction report.
56
- The gap between the two dates is the reporting lag.
57
-
58
- ``disclosureDate`` is ``None`` for historical rows collected
59
- before the field was captured upstream. In the DataFrame branch
60
- ``date`` becomes the index and ``disclosureDate`` is a column
61
- whose missing values read as ``None`` or ``NaN`` depending on the
62
- pandas version — test them with :func:`pandas.isna`.
54
+ ``amount``, ``owner``, ``amountRaw``, ``amountFlag`` and
55
+ ``disclosureDate`` — the date the trade was publicly disclosed
56
+ in the member's periodic transaction report. The gap between the
57
+ two dates is the reporting lag.
58
+
59
+ ``owner`` is the beneficial owner of the traded account:
60
+ ``"SELF"``, ``"SP"`` (spouse), ``"DC"`` (dependent child),
61
+ ``"JT"`` (joint), or an account code. House filings that leave
62
+ the owner column blank report as ``"SELF"``, per the House
63
+ instructions for the PTR form.
64
+
65
+ ``amount`` is normalized to the statutory STOCK Act bracket
66
+ (e.g. ``"$1,001 - $15,000"``) whenever the filed string is an
67
+ unambiguous formatting variant of one. On rows that were
68
+ normalized, ``amountRaw`` preserves the string as originally
69
+ filed. When the filed amount could not be safely normalized,
70
+ ``amount`` keeps the raw filed string (or ``"Unknown"`` when the
71
+ filing had no usable amount) and ``amountFlag`` is ``"review"``
72
+ or ``"ambiguous"``; on all other rows ``amountRaw`` and
73
+ ``amountFlag`` are ``None``.
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`.
63
81
 
64
82
  Notes
65
83
  -----
@@ -71,7 +89,8 @@ class HouseTradesAPI:
71
89
 
72
90
  {"date": "2026-06-15", "politician": "Jane Doe",
73
91
  "transactionType": "Purchase", "amount": "$1,001 - $15,000",
74
- "disclosureDate": "2026-07-01"}
92
+ "owner": "JT", "amountRaw": "$1,001 - $15,000 *",
93
+ "amountFlag": None, "disclosureDate": "2026-07-01"}
75
94
 
76
95
  """
77
96
  params: Dict[str, str] = {}
@@ -116,8 +116,10 @@ class ScreenerAPI:
116
116
  Screen House trades across all tickers.
117
117
 
118
118
  Rows carry ``symbol``, ``name``, ``date``, ``politician``,
119
- ``transactionType``, ``amount`` and ``disclosureDate`` (the public
120
- disclosure date, ``None`` on historical rows).
119
+ ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
120
+ account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, or an account
121
+ code) and ``disclosureDate`` (the public disclosure date). ``owner``
122
+ and ``disclosureDate`` are ``None`` on historical rows.
121
123
  """
122
124
  params = self._build_params(limit=limit)
123
125
  return self._get("screener/congress/house", params, as_dataframe)
@@ -134,8 +136,11 @@ class ScreenerAPI:
134
136
  Screen Senate trades across all tickers.
135
137
 
136
138
  Rows carry ``symbol``, ``name``, ``date``, ``politician``,
137
- ``transactionType``, ``amount`` and ``disclosureDate`` (the public
138
- disclosure date, ``None`` on historical rows).
139
+ ``transactionType``, ``amount``, ``owner`` (beneficial owner of the
140
+ account: ``"SELF"``, ``"SP"``, ``"DC"``, ``"JT"``, an account code,
141
+ or ``"UNKNOWN"`` for blank Senate filings) and ``disclosureDate``
142
+ (the public disclosure date). ``owner`` and ``disclosureDate`` are
143
+ ``None`` on historical rows.
139
144
  """
140
145
  params = self._build_params(limit=limit)
141
146
  return self._get("screener/congress/senate", params, as_dataframe)
@@ -51,15 +51,32 @@ class SenateTradesAPI:
51
51
  dict | pandas.DataFrame
52
52
  The raw dict has a ``trades`` list whose rows carry ``date``
53
53
  (the transaction date), ``politician``, ``transactionType``,
54
- ``amount`` and ``disclosureDate`` — the date the trade was
55
- publicly disclosed in the member's periodic transaction report.
56
- The gap between the two dates is the reporting lag.
57
-
58
- ``disclosureDate`` is ``None`` for historical rows collected
59
- before the field was captured upstream. In the DataFrame branch
60
- ``date`` becomes the index and ``disclosureDate`` is a column
61
- whose missing values read as ``None`` or ``NaN`` depending on the
62
- pandas version — test them with :func:`pandas.isna`.
54
+ ``amount``, ``owner``, ``amountRaw``, ``amountFlag`` and
55
+ ``disclosureDate`` — the date the trade was publicly disclosed
56
+ in the member's periodic transaction report. The gap between the
57
+ two dates is the reporting lag.
58
+
59
+ ``owner`` is the beneficial owner of the traded account:
60
+ ``"SELF"``, ``"SP"`` (spouse), ``"DC"`` (dependent child),
61
+ ``"JT"`` (joint), an account code, or ``"UNKNOWN"`` when the
62
+ Senate filing left the owner column blank.
63
+
64
+ ``amount`` is normalized to the statutory STOCK Act bracket
65
+ (e.g. ``"$1,001 - $15,000"``) whenever the filed string is an
66
+ unambiguous formatting variant of one. On rows that were
67
+ normalized, ``amountRaw`` preserves the string as originally
68
+ filed. When the filed amount could not be safely normalized,
69
+ ``amount`` keeps the raw filed string (or ``"Unknown"`` when the
70
+ filing had no usable amount) and ``amountFlag`` is ``"review"``
71
+ or ``"ambiguous"``; on all other rows ``amountRaw`` and
72
+ ``amountFlag`` are ``None``.
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`.
63
80
 
64
81
  Notes
65
82
  -----
@@ -71,7 +88,8 @@ class SenateTradesAPI:
71
88
 
72
89
  {"date": "2026-06-10", "politician": "Jane Doe",
73
90
  "transactionType": "Purchase", "amount": "$1,001 - $15,000",
74
- "disclosureDate": "2026-06-25"}
91
+ "owner": "SP", "amountRaw": "$1,001-$15,000",
92
+ "amountFlag": None, "disclosureDate": "2026-06-25"}
75
93
 
76
94
  """
77
95
  params: Dict[str, str] = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.2.6
3
+ Version: 0.2.8
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
@@ -84,7 +84,8 @@ fb.analyst_ratings.ticker("AMZN",
84
84
  as_dataframe=True)
85
85
 
86
86
  # ---------- house trades ----------
87
- # Rows include `disclosureDate` alongside the transaction `date`.
87
+ # Rows include `disclosureDate`, `owner`, `amountRaw` and `amountFlag`
88
+ # alongside the transaction `date` — see "Congressional trade fields" below.
88
89
  fb.house_trades.ticker("AMZN",
89
90
  date_from="2025-01-01",
90
91
  date_to="2025-06-30",
@@ -156,7 +157,7 @@ fb.screener.insider_trading(limit=50)
156
157
  fb.screener.reddit_mentions(limit=100, as_dataframe=True)
157
158
  fb.screener.government_contracts(limit=100, as_dataframe=True)
158
159
  fb.screener.patent_filings(limit=100, as_dataframe=True)
159
- fb.screener.congress_house(limit=50) # rows carry `disclosureDate`
160
+ fb.screener.congress_house(limit=50) # rows carry `disclosureDate` and `owner`
160
161
  fb.screener.congress_senate(limit=50)
161
162
 
162
163
  # ---------- recent data ----------
@@ -164,7 +165,7 @@ fb.recent.news(limit=100, as_dataframe=True)
164
165
  fb.recent.analyst_ratings(limit=50)
165
166
  ```
166
167
 
167
- ### Congressional trade dates
168
+ ### Congressional trade fields
168
169
 
169
170
  House and Senate trade rows carry **two** dates, and the gap between them is
170
171
  the reporting lag — often weeks:
@@ -174,13 +175,31 @@ the reporting lag — often weeks:
174
175
  | `date` | Transaction date — when the member actually bought or sold |
175
176
  | `disclosureDate` | Public disclosure date — when the periodic transaction report ran |
176
177
 
177
- `disclosureDate` is `null` on historical rows collected before the field was
178
- captured upstream. With `as_dataframe=True`, `date` is the **index** and
179
- `disclosureDate` is a column whose missing values read as `None` or `NaN`
180
- depending on your pandas version — test them with `pandas.isna()` rather than
181
- `is None`. Note that `.dropna()` on such a frame will now discard every
182
- historical row. The same field is present on `fb.screener.congress_house()`
183
- and `fb.screener.congress_senate()` rows.
178
+ Rows also identify **whose account** traded and how the filed amount was
179
+ normalized:
180
+
181
+ | Field | Meaning |
182
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
183
+ | `owner` | Beneficial owner of the account: `SELF`, `SP` (spouse), `DC` (dependent child), `JT` (joint), or an account code |
184
+ | `amountRaw` | The amount string as originally filed — set only when `amount` was rewritten to the canonical STOCK Act bracket, `null` otherwise |
185
+ | `amountFlag` | `null` on clean rows; `review` or `ambiguous` when the filed amount could not be safely normalized (then `amount` keeps the raw string as filed) |
186
+
187
+ `amount` is normalized to the ten statutory STOCK Act brackets (e.g.
188
+ `"$1,001 - $15,000"`) whenever the filed string is an unambiguous formatting
189
+ variant of one; open-ended filing categories like `"Over $1,000,000"` are
190
+ kept as filed. A filing with no usable amount at all reports `amount` as
191
+ `"Unknown"` with `amountFlag` = `review`. Senate filings that leave the owner
192
+ column blank report `owner` as `UNKNOWN`; House filings that leave it blank
193
+ report `SELF`, per the House PTR-form instructions.
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=[...])`.
201
+ `disclosureDate` and `owner` are also present on
202
+ `fb.screener.congress_house()` and `fb.screener.congress_senate()` rows.
184
203
 
185
204
  `date_from` / `date_to` bound the **transaction** date, not the disclosure
186
205
  date — a trade executed inside the window is returned even if it was disclosed
@@ -193,6 +212,12 @@ lag_days = [
193
212
  for t in trades
194
213
  if t["disclosureDate"]
195
214
  ]
215
+
216
+ # Only the member's own trades, skipping flagged amounts
217
+ own = [
218
+ t for t in trades
219
+ if t["owner"] == "SELF" and t["amountFlag"] is None
220
+ ]
196
221
  ```
197
222
 
198
223
  ## ⚡ Async Usage
@@ -0,0 +1,8 @@
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
+ }
@@ -21,6 +21,9 @@ def test_house_trades_raw_ok(client, _activate_responses):
21
21
  "politician": "Nancy Pelosi",
22
22
  "transactionType": "Purchase",
23
23
  "amount": "$15,001 - $50,000",
24
+ "owner": "JT",
25
+ "amountRaw": "$15,001 - $50,000 *",
26
+ "amountFlag": None,
24
27
  "disclosureDate": "2024-02-05",
25
28
  }
26
29
  ],
@@ -33,6 +36,10 @@ def test_house_trades_raw_ok(client, _activate_responses):
33
36
  assert isinstance(data["trades"], list)
34
37
  assert data["trades"][0]["politician"] == "Nancy Pelosi"
35
38
  assert data["trades"][0]["disclosureDate"] == "2024-02-05"
39
+ assert data["trades"][0]["owner"] == "JT"
40
+ # The bracket was normalized, so the originally filed string survives.
41
+ assert data["trades"][0]["amountRaw"] == "$15,001 - $50,000 *"
42
+ assert data["trades"][0]["amountFlag"] is None
36
43
 
37
44
 
38
45
  # ─────────── DataFrame branch ───────────────────────────────────────────
@@ -48,13 +55,19 @@ def test_house_trades_dataframe_ok(client, _activate_responses):
48
55
  "politician": "Nancy Pelosi",
49
56
  "transactionType": "Purchase",
50
57
  "amount": "$15,001 - $50,000",
58
+ "owner": "SP",
59
+ "amountRaw": None,
60
+ "amountFlag": None,
51
61
  "disclosureDate": "2024-02-05",
52
62
  },
53
63
  {
54
64
  "date": "2024-01-10",
55
65
  "politician": "Pete Sessions",
56
66
  "transactionType": "Sale",
57
- "amount": "$1,001 - $15,000",
67
+ "amount": "Unknown",
68
+ "owner": None,
69
+ "amountRaw": None,
70
+ "amountFlag": "review",
58
71
  "disclosureDate": None,
59
72
  },
60
73
  ],
@@ -70,6 +83,9 @@ def test_house_trades_dataframe_ok(client, _activate_responses):
70
83
  "politician",
71
84
  "transactionType",
72
85
  "amount",
86
+ "owner",
87
+ "amountRaw",
88
+ "amountFlag",
73
89
  "disclosureDate",
74
90
  }
75
91
  assert df.index.name == "date"
@@ -80,9 +96,16 @@ def test_house_trades_dataframe_ok(client, _activate_responses):
80
96
  assert df.loc["2024-01-15", "transactionType"] == "Purchase"
81
97
  assert df.loc["2024-01-15", "amount"] == "$15,001 - $50,000"
82
98
  assert df.loc["2024-01-15", "disclosureDate"] == "2024-02-05"
83
- # Historical rows predate the disclosure-date field; JSON null becomes
84
- # NaN once pandas builds the column.
99
+ assert df.loc["2024-01-15", "owner"] == "SP"
100
+ # A filing with no usable amount stores the explicit "Unknown"
101
+ # placeholder and carries a review flag.
102
+ assert df.loc["2024-01-10", "amount"] == "Unknown"
103
+ assert df.loc["2024-01-10", "amountFlag"] == "review"
104
+ # Historical rows predate the disclosure-date and owner fields; JSON null
105
+ # becomes NaN once pandas builds the column.
85
106
  assert pd.isna(df.loc["2024-01-10", "disclosureDate"])
107
+ assert pd.isna(df.loc["2024-01-10", "owner"])
108
+ assert pd.isna(df.loc["2024-01-15", "amountFlag"])
86
109
 
87
110
 
88
111
  # ─────────── error mapping ──────────────────────────────────────────────
@@ -231,8 +231,14 @@ class TestHouseTrades:
231
231
  assert "politician" in trades[0]
232
232
  assert "transactionType" in trades[0]
233
233
  # Present on every row; null on rows collected before the
234
- # disclosure-date field was added to the pipeline.
234
+ # fields were added to the pipeline.
235
235
  assert "disclosureDate" in trades[0]
236
+ assert "owner" in trades[0]
237
+ # Amount normalization metadata: null unless the filed amount
238
+ # was rewritten to a STOCK Act bracket (amountRaw) or could not
239
+ # be safely normalized (amountFlag).
240
+ assert "amountRaw" in trades[0]
241
+ assert "amountFlag" in trades[0]
236
242
 
237
243
  def test_dataframe(self, fb):
238
244
  df = fb.house_trades.ticker(TICKER, as_dataframe=True)
@@ -240,9 +246,12 @@ class TestHouseTrades:
240
246
  if len(df) > 0:
241
247
  assert df.index.name == "date"
242
248
  assert "politician" in df.columns
243
- # Survives the DataFrame conversion as a column (values may be
244
- # null on rows predating the upstream field).
249
+ # Survive the DataFrame conversion as columns (values may be
250
+ # null on rows predating the upstream fields).
245
251
  assert "disclosureDate" in df.columns
252
+ assert "owner" in df.columns
253
+ assert "amountRaw" in df.columns
254
+ assert "amountFlag" in df.columns
246
255
 
247
256
 
248
257
  # =====================================================================
@@ -259,8 +268,14 @@ class TestSenateTrades:
259
268
  assert "date" in trades[0]
260
269
  assert "politician" in trades[0]
261
270
  # Present on every row; null on rows collected before the
262
- # disclosure-date field was added to the pipeline.
271
+ # fields were added to the pipeline.
263
272
  assert "disclosureDate" in trades[0]
273
+ assert "owner" in trades[0]
274
+ # Amount normalization metadata: null unless the filed amount
275
+ # was rewritten to a STOCK Act bracket (amountRaw) or could not
276
+ # be safely normalized (amountFlag).
277
+ assert "amountRaw" in trades[0]
278
+ assert "amountFlag" in trades[0]
264
279
 
265
280
  def test_dataframe(self, fb):
266
281
  df = fb.senate_trades.ticker(TICKER, as_dataframe=True)
@@ -268,9 +283,12 @@ class TestSenateTrades:
268
283
  if len(df) > 0:
269
284
  assert df.index.name == "date"
270
285
  assert "politician" in df.columns
271
- # Survives the DataFrame conversion as a column (values may be
272
- # null on rows predating the upstream field).
286
+ # Survive the DataFrame conversion as columns (values may be
287
+ # null on rows predating the upstream fields).
273
288
  assert "disclosureDate" in df.columns
289
+ assert "owner" in df.columns
290
+ assert "amountRaw" in df.columns
291
+ assert "amountFlag" in df.columns
274
292
 
275
293
 
276
294
  # =====================================================================
@@ -517,12 +535,14 @@ class TestScreener:
517
535
  assert isinstance(data, list)
518
536
  if data:
519
537
  assert "disclosureDate" in data[0]
538
+ assert "owner" in data[0]
520
539
 
521
540
  def test_congress_senate(self, fb):
522
541
  data = fb.screener.congress_senate(limit=5)
523
542
  assert isinstance(data, list)
524
543
  if data:
525
544
  assert "disclosureDate" in data[0]
545
+ assert "owner" in data[0]
526
546
 
527
547
  def test_news(self, fb):
528
548
  data = fb.screener.news(limit=5)
@@ -99,6 +99,7 @@ def test_screener_congress_house(client, _activate_responses):
99
99
  "symbol": "AAPL",
100
100
  "name": "Apple",
101
101
  "politician": "Nancy Pelosi",
102
+ "owner": "SP",
102
103
  "disclosureDate": "2026-02-05",
103
104
  },
104
105
  ])
@@ -107,6 +108,7 @@ def test_screener_congress_house(client, _activate_responses):
107
108
  assert isinstance(data, list)
108
109
  assert len(data) == 1
109
110
  assert data[0]["politician"] == "Nancy Pelosi"
111
+ assert data[0]["owner"] == "SP"
110
112
  assert data[0]["disclosureDate"] == "2026-02-05"
111
113
 
112
114
 
@@ -116,12 +118,14 @@ def test_screener_congress_house_dataframe(client, _activate_responses):
116
118
  "symbol": "AAPL",
117
119
  "name": "Apple",
118
120
  "politician": "Nancy Pelosi",
121
+ "owner": "SP",
119
122
  "disclosureDate": "2026-02-05",
120
123
  },
121
124
  {
122
125
  "symbol": "MSFT",
123
126
  "name": "Microsoft",
124
127
  "politician": "Dan Crenshaw",
128
+ "owner": None,
125
129
  "disclosureDate": None,
126
130
  },
127
131
  ])
@@ -130,12 +134,14 @@ def test_screener_congress_house_dataframe(client, _activate_responses):
130
134
  assert isinstance(df, pd.DataFrame)
131
135
  assert len(df) == 2
132
136
  assert df.index.name == "symbol"
133
- assert set(df.columns) == {"name", "politician", "disclosureDate"}
137
+ assert set(df.columns) == {"name", "politician", "owner", "disclosureDate"}
134
138
  assert df.loc["AAPL", "politician"] == "Nancy Pelosi"
139
+ assert df.loc["AAPL", "owner"] == "SP"
135
140
  assert df.loc["AAPL", "disclosureDate"] == "2026-02-05"
136
- # Historical rows predate the disclosure-date field; JSON null becomes
137
- # NaN once pandas builds the column.
141
+ # Historical rows predate the disclosure-date and owner fields; JSON null
142
+ # becomes NaN once pandas builds the column.
138
143
  assert pd.isna(df.loc["MSFT", "disclosureDate"])
144
+ assert pd.isna(df.loc["MSFT", "owner"])
139
145
 
140
146
 
141
147
  # ── congress senate ────────────────────────────────────────────────────
@@ -145,6 +151,7 @@ def test_screener_congress_senate(client, _activate_responses):
145
151
  "symbol": "AAPL",
146
152
  "name": "Apple",
147
153
  "politician": "John Boozman",
154
+ "owner": "UNKNOWN",
148
155
  "disclosureDate": "2026-01-22",
149
156
  },
150
157
  ])
@@ -153,6 +160,7 @@ def test_screener_congress_senate(client, _activate_responses):
153
160
  assert isinstance(data, list)
154
161
  assert len(data) == 1
155
162
  assert data[0]["politician"] == "John Boozman"
163
+ assert data[0]["owner"] == "UNKNOWN"
156
164
  assert data[0]["disclosureDate"] == "2026-01-22"
157
165
 
158
166
 
@@ -162,12 +170,14 @@ def test_screener_congress_senate_dataframe(client, _activate_responses):
162
170
  "symbol": "AAPL",
163
171
  "name": "Apple",
164
172
  "politician": "John Boozman",
173
+ "owner": "SELF",
165
174
  "disclosureDate": "2026-01-22",
166
175
  },
167
176
  {
168
177
  "symbol": "NVDA",
169
178
  "name": "NVIDIA",
170
179
  "politician": "Tommy Tuberville",
180
+ "owner": None,
171
181
  "disclosureDate": None,
172
182
  },
173
183
  ])
@@ -176,12 +186,14 @@ def test_screener_congress_senate_dataframe(client, _activate_responses):
176
186
  assert isinstance(df, pd.DataFrame)
177
187
  assert len(df) == 2
178
188
  assert df.index.name == "symbol"
179
- assert set(df.columns) == {"name", "politician", "disclosureDate"}
189
+ assert set(df.columns) == {"name", "politician", "owner", "disclosureDate"}
180
190
  assert df.loc["NVDA", "politician"] == "Tommy Tuberville"
191
+ assert df.loc["AAPL", "owner"] == "SELF"
181
192
  assert df.loc["AAPL", "disclosureDate"] == "2026-01-22"
182
- # Historical rows predate the disclosure-date field; JSON null becomes
183
- # NaN once pandas builds the column.
193
+ # Historical rows predate the disclosure-date and owner fields; JSON null
194
+ # becomes NaN once pandas builds the column.
184
195
  assert pd.isna(df.loc["NVDA", "disclosureDate"])
196
+ assert pd.isna(df.loc["NVDA", "owner"])
185
197
 
186
198
 
187
199
  # ── news ───────────────────────────────────────────────────────────────
@@ -21,6 +21,9 @@ def test_senate_trades_raw_ok(client, _activate_responses):
21
21
  "politician": "Shelley Moore Capito",
22
22
  "transactionType": "Purchase",
23
23
  "amount": "$1,001 - $15,000",
24
+ "owner": "SP",
25
+ "amountRaw": "$1,001-$15,000",
26
+ "amountFlag": None,
24
27
  "disclosureDate": "2024-01-30",
25
28
  }
26
29
  ],
@@ -33,6 +36,10 @@ def test_senate_trades_raw_ok(client, _activate_responses):
33
36
  assert isinstance(data["trades"], list)
34
37
  assert data["trades"][0]["politician"] == "Shelley Moore Capito"
35
38
  assert data["trades"][0]["disclosureDate"] == "2024-01-30"
39
+ assert data["trades"][0]["owner"] == "SP"
40
+ # The bracket was normalized, so the originally filed string survives.
41
+ assert data["trades"][0]["amountRaw"] == "$1,001-$15,000"
42
+ assert data["trades"][0]["amountFlag"] is None
36
43
 
37
44
 
38
45
  # ─────────── DataFrame branch ───────────────────────────────────────────
@@ -48,13 +55,19 @@ def test_senate_trades_dataframe_ok(client, _activate_responses):
48
55
  "politician": "Shelley Moore Capito",
49
56
  "transactionType": "Purchase",
50
57
  "amount": "$1,001 - $15,000",
58
+ "owner": "SELF",
59
+ "amountRaw": None,
60
+ "amountFlag": None,
51
61
  "disclosureDate": "2024-01-30",
52
62
  },
53
63
  {
54
64
  "date": "2024-01-08",
55
65
  "politician": "John Boozman",
56
66
  "transactionType": "Purchase",
57
- "amount": "$1,001 - $15,000",
67
+ "amount": "$1,001 - $50,000",
68
+ "owner": None,
69
+ "amountRaw": None,
70
+ "amountFlag": "ambiguous",
58
71
  "disclosureDate": None,
59
72
  },
60
73
  ],
@@ -70,6 +83,9 @@ def test_senate_trades_dataframe_ok(client, _activate_responses):
70
83
  "politician",
71
84
  "transactionType",
72
85
  "amount",
86
+ "owner",
87
+ "amountRaw",
88
+ "amountFlag",
73
89
  "disclosureDate",
74
90
  }
75
91
  assert df.index.name == "date"
@@ -78,11 +94,16 @@ def test_senate_trades_dataframe_ok(client, _activate_responses):
78
94
  assert pd.Timestamp("2024-01-08") in df.index
79
95
  assert df.loc["2024-01-08", "politician"] == "John Boozman"
80
96
  assert df.loc["2024-01-15", "transactionType"] == "Purchase"
81
- assert df.loc["2024-01-08", "amount"] == "$1,001 - $15,000"
97
+ assert df.loc["2024-01-08", "amount"] == "$1,001 - $50,000"
82
98
  assert df.loc["2024-01-15", "disclosureDate"] == "2024-01-30"
83
- # Historical rows predate the disclosure-date field; JSON null becomes
84
- # NaN once pandas builds the column.
99
+ assert df.loc["2024-01-15", "owner"] == "SELF"
100
+ # A flagged amount keeps the raw filed string in `amount`.
101
+ assert df.loc["2024-01-08", "amountFlag"] == "ambiguous"
102
+ # Historical rows predate the disclosure-date and owner fields; JSON null
103
+ # becomes NaN once pandas builds the column.
85
104
  assert pd.isna(df.loc["2024-01-08", "disclosureDate"])
105
+ assert pd.isna(df.loc["2024-01-08", "owner"])
106
+ assert pd.isna(df.loc["2024-01-15", "amountFlag"])
86
107
 
87
108
 
88
109
  # ─────────── error mapping ──────────────────────────────────────────────
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.2.6",
3
- "distance": 0,
4
- "node": "ga5d5629fe29800f7665621cc40bf9c415aaea135",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-07-24"
8
- }
File without changes