finbrain-python 0.3.0__tar.gz → 0.3.2__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.3.0 → finbrain_python-0.3.2}/.github/workflows/ci.yml +4 -1
  2. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/.github/workflows/release.yml +4 -1
  3. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/CHANGELOG.md +23 -0
  4. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/PKG-INFO +27 -1
  5. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/README.md +26 -0
  6. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/insider_transactions.py +7 -1
  7. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/screener.py +6 -1
  8. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/app_ratings.py +14 -0
  9. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/insider_transactions.py +5 -0
  10. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/screener.py +6 -1
  11. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/PKG-INFO +27 -1
  12. finbrain_python-0.3.2/src/finbrain_python.egg-info/scm_version.json +8 -0
  13. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_app_ratings.py +38 -0
  14. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_insider_transactions.py +40 -0
  15. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_screener.py +3 -1
  16. finbrain_python-0.3.0/src/finbrain_python.egg-info/scm_version.json +0 -8
  17. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/.gitattributes +0 -0
  18. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/.gitignore +0 -0
  19. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/LICENSE +0 -0
  20. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/RELEASE.md +0 -0
  21. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/examples/async_example.py +0 -0
  22. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/examples/transactions_plotting_example.py +0 -0
  23. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/pyproject.toml +0 -0
  24. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/setup.cfg +0 -0
  25. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/__init__.py +0 -0
  26. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/__init__.py +0 -0
  27. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/client.py +0 -0
  28. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/__init__.py +0 -0
  29. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/_utils.py +0 -0
  30. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/analyst_ratings.py +0 -0
  31. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/app_ratings.py +0 -0
  32. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/available.py +0 -0
  33. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/corporate_lobbying.py +0 -0
  34. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/government_contracts.py +0 -0
  35. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/house_trades.py +0 -0
  36. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/linkedin_data.py +0 -0
  37. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/news.py +0 -0
  38. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/options.py +0 -0
  39. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/patent_filings.py +0 -0
  40. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/predictions.py +0 -0
  41. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/recent.py +0 -0
  42. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/reddit_mentions.py +0 -0
  43. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/senate_trades.py +0 -0
  44. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/aio/endpoints/sentiments.py +0 -0
  45. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/client.py +0 -0
  46. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/__init__.py +0 -0
  47. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/_utils.py +0 -0
  48. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/analyst_ratings.py +0 -0
  49. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/available.py +0 -0
  50. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/corporate_lobbying.py +0 -0
  51. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/government_contracts.py +0 -0
  52. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/house_trades.py +0 -0
  53. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/linkedin_data.py +0 -0
  54. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/news.py +0 -0
  55. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/options.py +0 -0
  56. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/patent_filings.py +0 -0
  57. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/predictions.py +0 -0
  58. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/recent.py +0 -0
  59. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/reddit_mentions.py +0 -0
  60. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/senate_trades.py +0 -0
  61. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/endpoints/sentiments.py +0 -0
  62. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/exceptions.py +0 -0
  63. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/plotting.py +0 -0
  64. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain/py.typed +0 -0
  65. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/SOURCES.txt +0 -0
  66. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/dependency_links.txt +0 -0
  67. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/requires.txt +0 -0
  68. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/scm_file_list.json +0 -0
  69. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/src/finbrain_python.egg-info/top_level.txt +0 -0
  70. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/__init__.py +0 -0
  71. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/conftest.py +0 -0
  72. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_analyst_ratings.py +0 -0
  73. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_async_client.py +0 -0
  74. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_available.py +0 -0
  75. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_cik_passthrough.py +0 -0
  76. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_client.py +0 -0
  77. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_corporate_lobbying.py +0 -0
  78. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_envelope.py +0 -0
  79. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_government_contracts.py +0 -0
  80. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_house_trades.py +0 -0
  81. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_integration.py +0 -0
  82. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_linkedin_data.py +0 -0
  83. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_news.py +0 -0
  84. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_options.py +0 -0
  85. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_patent_filings.py +0 -0
  86. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_plotting.py +0 -0
  87. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_predictions.py +0 -0
  88. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_recent.py +0 -0
  89. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_reddit_mentions.py +0 -0
  90. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_senate_trades.py +0 -0
  91. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_sentiments.py +0 -0
  92. {finbrain_python-0.3.0 → finbrain_python-0.3.2}/tests/test_utils.py +0 -0
@@ -7,7 +7,10 @@ on:
7
7
 
8
8
  jobs:
9
9
  test:
10
- runs-on: ubuntu-latest
10
+ # ubuntu-latest is Ubuntu 26.04, whose runner image has no Python 3.9
11
+ # (end of life October 2025). 3.9 is still supported by this package
12
+ # (requires-python >=3.9), so its job runs on 24.04, which still has it.
13
+ runs-on: ${{ matrix.python == '3.9' && 'ubuntu-24.04' || 'ubuntu-latest' }}
11
14
  strategy:
12
15
  matrix:
13
16
  python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
@@ -10,7 +10,10 @@ jobs:
10
10
  # commit with failing checks could still reach PyPI -- and PyPI versions are
11
11
  # immutable, so a bad upload cannot be replaced, only superseded.
12
12
  test:
13
- runs-on: ubuntu-latest
13
+ # ubuntu-latest is Ubuntu 26.04, whose runner image has no Python 3.9
14
+ # (end of life October 2025). 3.9 is still supported by this package
15
+ # (requires-python >=3.9), so its job runs on 24.04, which still has it.
16
+ runs-on: ${{ matrix.python == '3.9' && 'ubuntu-24.04' || 'ubuntu-latest' }}
14
17
  strategy:
15
18
  matrix:
16
19
  python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
@@ -5,6 +5,27 @@ 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.3.2] - 2026-11-28
9
+
10
+ ### Added
11
+
12
+ - **Documentation for insider `valueFlag`**: insider rows from `fb.insider_transactions.ticker()` and `fb.screener.insider_trading()` (sync and async) carry the v2 API's `valueFlag`: `null` on normal rows, `price_implausible` when the filer typed the total proceeds into the price field (about 300 rows in the whole archive), so that row's `pricePerShare` and `totalValue` must not be summed. The field already passed through both the raw-dict and DataFrame branches with no SDK code change; docstrings, a README section (with a filtering example and the open-market `Purchase`/`Sale` note) and unit tests now cover it. `totalValue` is shares × price on every other row since the API's November 2026 value repair
13
+ - **Senate pause noted** in the README: Senate rows stop at 2026-10-22 while collection is paused; House continues
14
+
15
+ ### Changed
16
+
17
+ - **DataFrame shape**: insider frames gain a `valueFlag` column (it arrives from the API, not from this release). Code that asserts an exact column set needs updating
18
+
19
+ ### Fixed
20
+
21
+ - **CI on Python 3.9**: GitHub's `ubuntu-latest` runner moved to Ubuntu 26.04, which has no Python 3.9, so the 3.9 job failed at setup. It now runs on `ubuntu-24.04` (CI and release workflows); the package still supports 3.9
22
+
23
+ ## [0.3.1] - 2026-09-07
24
+
25
+ ### Added
26
+
27
+ - **`cik` on app ratings**: the v2 API now carries the company's SEC Central Index Key on the app-ratings response, and both DataFrame branches expose it as a `cik` column (`per_app=True` and the blended view). It is one value per company, repeated down the frame, kept as a string because the leading zeros are part of the identifier, and `None` for an issuer with no SEC registration such as a non-US listing. The raw-dict branch carried it already, being a passthrough. A CIK survives what a symbol does not: renames (BK became BNY) and recycled symbols, so it is the key to join app ratings to the insider, lobbying, contracts and patents datasets
28
+
8
29
  ## [0.3.0] - 2026-09-04
9
30
 
10
31
  ### Added
@@ -267,6 +288,8 @@ Previous releases...
267
288
 
268
289
  Previous releases...
269
290
 
291
+ [0.3.2]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.3.1...v0.3.2
292
+ [0.3.1]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.3.0...v0.3.1
270
293
  [0.3.0]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.2.9...v0.3.0
271
294
  [0.2.1]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.2.0...v0.2.1
272
295
  [0.2.0]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.1.8...v0.2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.3.0
3
+ Version: 0.3.2
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
@@ -211,6 +211,32 @@ All four fields — `owner`, `amountRaw`, `amountFlag` and `disclosureDate` —
211
211
  are also present on `fb.screener.congress_house()` and
212
212
  `fb.screener.congress_senate()` rows.
213
213
 
214
+ Senate collection has been paused since 2026-10-22 (the Senate disclosure
215
+ site refuses automated access), so Senate rows stop at that date while it
216
+ is paused; House collection continues.
217
+
218
+ ### Insider transaction values (`valueFlag`)
219
+
220
+ Insider rows from `fb.insider_transactions.ticker()` and
221
+ `fb.screener.insider_trading()` carry `valueFlag`:
222
+
223
+ | Field | Meaning |
224
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
225
+ | `totalValue` | Shares × price on every row (derivative rows: notional at the exercise price) |
226
+ | `valueFlag` | `null` on normal rows; `price_implausible` when the filer typed the total proceeds into the price field, so `pricePerShare` and `totalValue` are not usable |
227
+
228
+ Leave flagged rows out of any dollar sum or average:
229
+
230
+ ```python
231
+ df = fb.insider_transactions.ticker("AMD", as_dataframe=True)
232
+ clean = df[df["valueFlag"].isna()]
233
+ open_market = clean[clean["transactionType"].isin(["Purchase", "Sale"])]
234
+ ```
235
+
236
+ Only `Purchase` and `Sale` are open-market trades at the insider's own
237
+ initiative; the other transaction types are awards, option exercises, tax
238
+ withholding, gifts and other transfers.
239
+
214
240
  ### Company identifier (`cik`)
215
241
 
216
242
  Rows from the four SEC/government datasets — `fb.insider_transactions`,
@@ -183,6 +183,32 @@ All four fields — `owner`, `amountRaw`, `amountFlag` and `disclosureDate` —
183
183
  are also present on `fb.screener.congress_house()` and
184
184
  `fb.screener.congress_senate()` rows.
185
185
 
186
+ Senate collection has been paused since 2026-10-22 (the Senate disclosure
187
+ site refuses automated access), so Senate rows stop at that date while it
188
+ is paused; House collection continues.
189
+
190
+ ### Insider transaction values (`valueFlag`)
191
+
192
+ Insider rows from `fb.insider_transactions.ticker()` and
193
+ `fb.screener.insider_trading()` carry `valueFlag`:
194
+
195
+ | Field | Meaning |
196
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
197
+ | `totalValue` | Shares × price on every row (derivative rows: notional at the exercise price) |
198
+ | `valueFlag` | `null` on normal rows; `price_implausible` when the filer typed the total proceeds into the price field, so `pricePerShare` and `totalValue` are not usable |
199
+
200
+ Leave flagged rows out of any dollar sum or average:
201
+
202
+ ```python
203
+ df = fb.insider_transactions.ticker("AMD", as_dataframe=True)
204
+ clean = df[df["valueFlag"].isna()]
205
+ open_market = clean[clean["transactionType"].isin(["Purchase", "Sale"])]
206
+ ```
207
+
208
+ Only `Purchase` and `Sale` are open-market trades at the insider's own
209
+ initiative; the other transaction types are awards, option exercises, tax
210
+ withholding, gifts and other transfers.
211
+
186
212
  ### Company identifier (`cik`)
187
213
 
188
214
  Rows from the four SEC/government datasets — `fb.insider_transactions`,
@@ -24,7 +24,13 @@ class AsyncInsiderTransactionsAPI:
24
24
  limit: int | None = None,
25
25
  as_dataframe: bool = False,
26
26
  ) -> Dict[str, Any] | pd.DataFrame:
27
- """Insider transactions for a symbol (async)."""
27
+ """Insider transactions for a symbol (async).
28
+
29
+ Rows carry ``valueFlag``: ``None`` normally, ``"price_implausible"``
30
+ when the filer typed the total proceeds into the price field, in
31
+ which case ``pricePerShare`` and ``totalValue`` must not be summed.
32
+ ``totalValue`` is shares x price on every other row.
33
+ """
28
34
  params: Dict[str, str] = {}
29
35
  if date_from:
30
36
  params["startDate"] = to_datestr(date_from)
@@ -95,7 +95,12 @@ class AsyncScreenerAPI:
95
95
  limit: int | None = None,
96
96
  as_dataframe: bool = False,
97
97
  ) -> List[Dict[str, Any]] | pd.DataFrame:
98
- """Screen insider trades across all tickers."""
98
+ """Screen insider trades across all tickers.
99
+
100
+ Rows carry ``valueFlag`` (``"price_implausible"`` when the filer typed
101
+ the total proceeds into the price field); leave those rows out of any
102
+ dollar sum or average.
103
+ """
99
104
  params = self._build_params(limit=limit)
100
105
  return await self._get("screener/insider-trading", params, as_dataframe)
101
106
 
@@ -148,6 +148,12 @@ class AppRatingsAPI:
148
148
  publish many apps (Apple has 140 on iOS) and which of them matters
149
149
  is your judgement, not ours.
150
150
 
151
+ Either frame carries a ``cik`` column: the company's SEC Central
152
+ Index Key, a 10-digit zero-padded string (leading zeros are data),
153
+ ``None`` for an issuer with no SEC registration. It is one value
154
+ per company, repeated down the frame, so a frame can be joined to
155
+ the other FinBrain datasets on the entity rather than the symbol.
156
+
151
157
  Returns
152
158
  -------
153
159
  dict | pandas.DataFrame
@@ -165,6 +171,12 @@ class AppRatingsAPI:
165
171
  data = self._c._request("GET", path, params=params)
166
172
 
167
173
  if as_dataframe:
174
+ # One value per company, so it is a constant column rather than a
175
+ # per-row field. Assigned after the flatten so the flatten stays a
176
+ # pure function of the rows it is given. Kept as an object column:
177
+ # a numeric dtype would eat the leading zeros.
178
+ cik = data.get("cik")
179
+
168
180
  if per_app:
169
181
  flat = _flatten_apps(data.get("apps") or [])
170
182
  df = pd.DataFrame(flat)
@@ -174,6 +186,7 @@ class AppRatingsAPI:
174
186
  # row per app, so a date index would not be unique.
175
187
  df.sort_values(["app_id", "date"], inplace=True)
176
188
  df.reset_index(drop=True, inplace=True)
189
+ df["cik"] = cik
177
190
  return df
178
191
 
179
192
  rows: List[Dict[str, Any]] = data.get("data", [])
@@ -182,6 +195,7 @@ class AppRatingsAPI:
182
195
  if not df.empty and "date" in df.columns:
183
196
  df["date"] = pd.to_datetime(df["date"])
184
197
  df.set_index("date", inplace=True)
198
+ df["cik"] = cik
185
199
  return df
186
200
 
187
201
  return data
@@ -49,6 +49,11 @@ class InsiderTransactionsAPI:
49
49
  Returns
50
50
  -------
51
51
  dict | pandas.DataFrame
52
+
53
+ Rows carry ``valueFlag``: ``None`` normally, ``"price_implausible"``
54
+ when the filer typed the total proceeds into the price field, in
55
+ which case ``pricePerShare`` and ``totalValue`` must not be summed.
56
+ ``totalValue`` is shares x price on every other row.
52
57
  """
53
58
  params: Dict[str, str] = {}
54
59
  if date_from:
@@ -100,7 +100,12 @@ class ScreenerAPI:
100
100
  limit: int | None = None,
101
101
  as_dataframe: bool = False,
102
102
  ) -> List[Dict[str, Any]] | pd.DataFrame:
103
- """Screen insider trades across all tickers."""
103
+ """Screen insider trades across all tickers.
104
+
105
+ Rows carry ``valueFlag`` (``"price_implausible"`` when the filer typed
106
+ the total proceeds into the price field); leave those rows out of any
107
+ dollar sum or average.
108
+ """
104
109
  params = self._build_params(limit=limit)
105
110
  return self._get("screener/insider-trading", params, as_dataframe)
106
111
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.3.0
3
+ Version: 0.3.2
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
@@ -211,6 +211,32 @@ All four fields — `owner`, `amountRaw`, `amountFlag` and `disclosureDate` —
211
211
  are also present on `fb.screener.congress_house()` and
212
212
  `fb.screener.congress_senate()` rows.
213
213
 
214
+ Senate collection has been paused since 2026-10-22 (the Senate disclosure
215
+ site refuses automated access), so Senate rows stop at that date while it
216
+ is paused; House collection continues.
217
+
218
+ ### Insider transaction values (`valueFlag`)
219
+
220
+ Insider rows from `fb.insider_transactions.ticker()` and
221
+ `fb.screener.insider_trading()` carry `valueFlag`:
222
+
223
+ | Field | Meaning |
224
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
225
+ | `totalValue` | Shares × price on every row (derivative rows: notional at the exercise price) |
226
+ | `valueFlag` | `null` on normal rows; `price_implausible` when the filer typed the total proceeds into the price field, so `pricePerShare` and `totalValue` are not usable |
227
+
228
+ Leave flagged rows out of any dollar sum or average:
229
+
230
+ ```python
231
+ df = fb.insider_transactions.ticker("AMD", as_dataframe=True)
232
+ clean = df[df["valueFlag"].isna()]
233
+ open_market = clean[clean["transactionType"].isin(["Purchase", "Sale"])]
234
+ ```
235
+
236
+ Only `Purchase` and `Sale` are open-market trades at the insider's own
237
+ initiative; the other transaction types are awards, option exercises, tax
238
+ withholding, gifts and other transfers.
239
+
214
240
  ### Company identifier (`cik`)
215
241
 
216
242
  Rows from the four SEC/government datasets — `fb.insider_transactions`,
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.3.2",
3
+ "distance": 0,
4
+ "node": "gb81c23e7ebba3200c06eb456a25d8ce81bf47dc1",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-28"
8
+ }
@@ -72,6 +72,7 @@ def test_app_ratings_dataframe(client, _activate_responses):
72
72
  "android_score",
73
73
  "android_ratingsCount",
74
74
  "android_installCount",
75
+ "cik", # one value per company, repeated down the frame
75
76
  }
76
77
  assert df.loc["2024-01-15", "ios_score"] == 4.07
77
78
  assert df.loc["2024-01-15", "android_ratingsCount"] == 567996
@@ -98,6 +99,7 @@ def _per_app_payload():
98
99
  {
99
100
  "symbol": "AAPL",
100
101
  "name": "Apple Inc.",
102
+ "cik": "0000320193",
101
103
  "data": [
102
104
  {
103
105
  "date": "2026-09-01",
@@ -231,3 +233,39 @@ def test_app_ratings_per_app_empty_when_api_predates_apps(client, _activate_resp
231
233
  df = client.app_ratings.ticker("AMZN", as_dataframe=True, per_app=True)
232
234
  assert isinstance(df, pd.DataFrame)
233
235
  assert df.empty
236
+
237
+
238
+ # ─────────── entity identity ────────────────────────────────────────────
239
+ def test_app_ratings_frames_carry_the_company_cik(client, _activate_responses):
240
+ """Both frames carry `cik` so they can be joined on the entity.
241
+
242
+ A symbol is not an identity: it gets renamed (BK -> BNY) and recycled.
243
+ The CIK is one value per company, so it repeats down the frame, and it
244
+ stays a string because the leading zeros are part of the identifier.
245
+ """
246
+ path = "app-ratings/AAPL"
247
+ stub_json(_activate_responses, "GET", path, _per_app_payload())
248
+
249
+ per_app = client.app_ratings.ticker("AAPL", as_dataframe=True, per_app=True)
250
+ assert list(per_app["cik"].unique()) == ["0000320193"]
251
+ # What matters is that a numeric dtype never eats the leading zeros.
252
+ # (Object dtype on pandas 2, the dedicated str dtype on pandas 3 - both
253
+ # are fine, so assert the property, not the implementation.)
254
+ assert not pd.api.types.is_numeric_dtype(per_app["cik"])
255
+ assert len(per_app) == 4 # the column does not add or drop rows
256
+
257
+ stub_json(_activate_responses, "GET", path, _per_app_payload())
258
+ blended = client.app_ratings.ticker("AAPL", as_dataframe=True)
259
+ assert list(blended["cik"].unique()) == ["0000320193"]
260
+
261
+ # the raw branch is a passthrough: no SDK code decides what it carries
262
+ stub_json(_activate_responses, "GET", path, _per_app_payload())
263
+ assert client.app_ratings.ticker("AAPL")["cik"] == "0000320193"
264
+
265
+
266
+ def test_app_ratings_cik_column_exists_when_the_issuer_has_none(client, _activate_responses):
267
+ """A non-US listing has no CIK; the column is still there, all null."""
268
+ payload = wrap_v2({"symbol": "SAP.DE", "name": "SAP SE", "cik": None, "data": [], "apps": []})
269
+ stub_json(_activate_responses, "GET", "app-ratings/SAP.DE", payload)
270
+ df = client.app_ratings.ticker("SAP.DE", as_dataframe=True, per_app=True)
271
+ assert "cik" in df.columns and df["cik"].isna().all()
@@ -82,6 +82,46 @@ def test_insider_tx_dataframe_ok(client, _activate_responses):
82
82
  assert df.loc["2024-01-15", "shares"] == 5000
83
83
 
84
84
 
85
+ # ─────────── valueFlag passthrough ──────────────────────────────────────
86
+ def test_insider_tx_value_flag_passthrough(client, _activate_responses):
87
+ path = f"insider-trading/{TICKER}"
88
+ payload = wrap_v2({
89
+ "symbol": "AMD",
90
+ "name": "Advanced Micro Devices Inc",
91
+ "transactions": [
92
+ {
93
+ "date": "2017-08-04",
94
+ "insider": "Filer A",
95
+ "transactionType": "Sale",
96
+ "shares": 40000000,
97
+ "pricePerShare": 525600000,
98
+ "totalValue": 21024000000000000,
99
+ "valueFlag": "price_implausible",
100
+ },
101
+ {
102
+ "date": "2017-08-03",
103
+ "insider": "Filer B",
104
+ "transactionType": "Purchase",
105
+ "shares": 100,
106
+ "pricePerShare": 13.0,
107
+ "totalValue": 1300,
108
+ "valueFlag": None,
109
+ },
110
+ ],
111
+ })
112
+ stub_json(_activate_responses, "GET", path, payload)
113
+
114
+ raw = client.insider_transactions.ticker(symbol=TICKER)
115
+ assert raw["transactions"][0]["valueFlag"] == "price_implausible"
116
+ assert raw["transactions"][1]["valueFlag"] is None
117
+
118
+ stub_json(_activate_responses, "GET", path, payload)
119
+ df = client.insider_transactions.ticker(symbol=TICKER, as_dataframe=True)
120
+ assert "valueFlag" in df.columns
121
+ clean = df[df["valueFlag"].isna()]
122
+ assert list(clean["insider"]) == ["Filer B"]
123
+
124
+
85
125
  # ─────────── error mapping ──────────────────────────────────────────────
86
126
  def test_insider_tx_bad_request(client, _activate_responses):
87
127
  path = f"insider-trading/{TICKER}"
@@ -68,13 +68,15 @@ def test_screener_analyst_ratings_dataframe(client, _activate_responses):
68
68
  # ── insider trading ────────────────────────────────────────────────────
69
69
  def test_screener_insider_trading(client, _activate_responses):
70
70
  payload = wrap_v2([
71
- {"symbol": "AAPL", "name": "Apple", "transactionType": "Sale", "shares": 5000},
71
+ {"symbol": "AAPL", "name": "Apple", "transactionType": "Sale", "shares": 5000,
72
+ "valueFlag": "price_implausible"},
72
73
  ])
73
74
  stub_json(_activate_responses, "GET", "screener/insider-trading", payload, params={"limit": "5"})
74
75
  data = client.screener.insider_trading(limit=5)
75
76
  assert isinstance(data, list)
76
77
  assert len(data) == 1
77
78
  assert data[0]["transactionType"] == "Sale"
79
+ assert data[0]["valueFlag"] == "price_implausible"
78
80
 
79
81
 
80
82
  def test_screener_insider_trading_dataframe(client, _activate_responses):
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.3.0",
3
- "distance": 0,
4
- "node": "gdb37d1ab98d41890f9c274e55cfbf193b19b4919",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-09-04"
8
- }
File without changes