finbrain-python 0.1.7__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/.github/workflows/ci.yml +1 -1
  2. finbrain_python-0.2.0/CHANGELOG.md +139 -0
  3. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/PKG-INFO +89 -54
  4. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/README.md +88 -53
  5. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/examples/async_example.py +0 -1
  6. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/examples/transactions_plotting_example.py +1 -4
  7. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/pyproject.toml +5 -0
  8. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/client.py +27 -8
  9. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/analyst_ratings.py +9 -9
  10. finbrain_python-0.2.0/src/finbrain/aio/endpoints/app_ratings.py +66 -0
  11. finbrain_python-0.2.0/src/finbrain/aio/endpoints/available.py +73 -0
  12. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/house_trades.py +9 -9
  13. finbrain_python-0.2.0/src/finbrain/aio/endpoints/insider_transactions.py +47 -0
  14. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/linkedin_data.py +8 -8
  15. finbrain_python-0.2.0/src/finbrain/aio/endpoints/news.py +47 -0
  16. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/options.py +8 -8
  17. finbrain_python-0.2.0/src/finbrain/aio/endpoints/predictions.py +45 -0
  18. finbrain_python-0.2.0/src/finbrain/aio/endpoints/recent.py +72 -0
  19. finbrain_python-0.2.0/src/finbrain/aio/endpoints/screener.py +210 -0
  20. finbrain_python-0.2.0/src/finbrain/aio/endpoints/senate_trades.py +48 -0
  21. finbrain_python-0.2.0/src/finbrain/aio/endpoints/sentiments.py +51 -0
  22. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/client.py +24 -7
  23. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/analyst_ratings.py +11 -16
  24. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/app_ratings.py +53 -25
  25. finbrain_python-0.2.0/src/finbrain/endpoints/available.py +131 -0
  26. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/house_trades.py +12 -15
  27. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/insider_transactions.py +25 -20
  28. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/linkedin_data.py +10 -16
  29. finbrain_python-0.2.0/src/finbrain/endpoints/news.py +68 -0
  30. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/options.py +11 -14
  31. finbrain_python-0.2.0/src/finbrain/endpoints/predictions.py +70 -0
  32. finbrain_python-0.2.0/src/finbrain/endpoints/recent.py +106 -0
  33. finbrain_python-0.2.0/src/finbrain/endpoints/screener.py +215 -0
  34. finbrain_python-0.2.0/src/finbrain/endpoints/senate_trades.py +73 -0
  35. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/sentiments.py +21 -34
  36. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/exceptions.py +40 -8
  37. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/plotting.py +137 -46
  38. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/PKG-INFO +89 -54
  39. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/SOURCES.txt +14 -0
  40. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/tests/conftest.py +19 -7
  41. finbrain_python-0.2.0/tests/test_analyst_ratings.py +88 -0
  42. finbrain_python-0.2.0/tests/test_app_ratings.py +81 -0
  43. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/tests/test_async_client.py +1 -0
  44. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/tests/test_available.py +28 -20
  45. finbrain_python-0.2.0/tests/test_envelope.py +109 -0
  46. finbrain_python-0.2.0/tests/test_house_trades.py +87 -0
  47. finbrain_python-0.2.0/tests/test_insider_transactions.py +97 -0
  48. finbrain_python-0.2.0/tests/test_integration.py +409 -0
  49. finbrain_python-0.2.0/tests/test_linkedin_data.py +85 -0
  50. finbrain_python-0.2.0/tests/test_news.py +66 -0
  51. finbrain_python-0.2.0/tests/test_options.py +91 -0
  52. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/tests/test_plotting.py +14 -18
  53. finbrain_python-0.2.0/tests/test_predictions.py +79 -0
  54. finbrain_python-0.2.0/tests/test_recent.py +66 -0
  55. finbrain_python-0.2.0/tests/test_screener.py +314 -0
  56. finbrain_python-0.2.0/tests/test_senate_trades.py +87 -0
  57. finbrain_python-0.2.0/tests/test_sentiments.py +93 -0
  58. finbrain_python-0.1.7/CHANGELOG.md +0 -89
  59. finbrain_python-0.1.7/src/finbrain/aio/endpoints/app_ratings.py +0 -49
  60. finbrain_python-0.1.7/src/finbrain/aio/endpoints/available.py +0 -41
  61. finbrain_python-0.1.7/src/finbrain/aio/endpoints/insider_transactions.py +0 -40
  62. finbrain_python-0.1.7/src/finbrain/aio/endpoints/predictions.py +0 -85
  63. finbrain_python-0.1.7/src/finbrain/aio/endpoints/sentiments.py +0 -55
  64. finbrain_python-0.1.7/src/finbrain/endpoints/available.py +0 -83
  65. finbrain_python-0.1.7/src/finbrain/endpoints/predictions.py +0 -130
  66. finbrain_python-0.1.7/tests/test_analyst_ratings.py +0 -88
  67. finbrain_python-0.1.7/tests/test_app_ratings.py +0 -56
  68. finbrain_python-0.1.7/tests/test_house_trades.py +0 -76
  69. finbrain_python-0.1.7/tests/test_insider_transactions.py +0 -82
  70. finbrain_python-0.1.7/tests/test_linkedin_data.py +0 -61
  71. finbrain_python-0.1.7/tests/test_options.py +0 -76
  72. finbrain_python-0.1.7/tests/test_predictions.py +0 -126
  73. finbrain_python-0.1.7/tests/test_sentiments.py +0 -86
  74. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/.gitattributes +0 -0
  75. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/.github/workflows/release.yml +0 -0
  76. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/.gitignore +0 -0
  77. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/LICENSE +0 -0
  78. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/RELEASE.md +0 -0
  79. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/setup.cfg +0 -0
  80. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/__init__.py +0 -0
  81. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/__init__.py +0 -0
  82. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/__init__.py +0 -0
  83. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/_utils.py +0 -0
  84. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/__init__.py +0 -0
  85. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/endpoints/_utils.py +0 -0
  86. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain/py.typed +0 -0
  87. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/dependency_links.txt +0 -0
  88. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/requires.txt +0 -0
  89. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/top_level.txt +0 -0
  90. {finbrain_python-0.1.7 → finbrain_python-0.2.0}/tests/__init__.py +0 -0
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- python: ['3.9', '3.10', '3.11', '3.12', '3.13']
10
+ python: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
11
11
  steps:
12
12
  - uses: actions/checkout@v4
13
13
  with:
@@ -0,0 +1,139 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-03-09
9
+
10
+ ### BREAKING CHANGES
11
+
12
+ - **v2 API Migration**: SDK now targets FinBrain API v2 (`/v2/` base URL)
13
+ - **Authentication**: Switched from `?token=` query parameter to `Authorization: Bearer` header
14
+ - **`market` parameter removed**: All per-symbol endpoint methods no longer accept `market` as an argument (v2 API identifies tickers by symbol alone)
15
+ - Affected: `sentiments.ticker()`, `analyst_ratings.ticker()`, `app_ratings.ticker()`, `options.put_call()`, `insider_transactions.ticker()`, `house_trades.ticker()`, `senate_trades.ticker()`, `linkedin_data.ticker()`, and all plotting methods
16
+ - **`predictions.market()` removed**: Use `screener.predictions_daily()` or `screener.predictions_monthly()` instead
17
+ - **`sentiments.ticker()` `days` parameter removed**: Use `date_from`/`date_to` instead
18
+ - **Response envelope**: All v2 responses are wrapped in `{"success": true, "data": ..., "meta": {...}}`. The SDK auto-unwraps this — endpoint methods return just the `data` portion
19
+ - **Prediction DataFrame columns**: `main` column renamed to `mid` (matching v2 API)
20
+ - **App Ratings DataFrame columns**: Flat columns like `playStoreScore` replaced with nested-then-flattened `ios_score`, `android_score`, `ios_ratingsCount`, `android_ratingsCount`, `android_installCount`
21
+ - **Options DataFrame columns**: `callCount`/`putCount` renamed to `callVolume`/`putVolume`
22
+ - **LinkedIn DataFrame columns**: `followersCount` renamed to `followerCount`
23
+ - **v2 API paths changed**: All endpoint URLs updated (e.g., `/sentiments/{MARKET}/{TICKER}` → `/sentiment/{SYMBOL}`, `/housetrades/` → `/congress/house/`, etc.)
24
+ - **Date query parameters**: Internal mapping changed from `dateFrom`/`dateTo` to `startDate`/`endDate` (Python parameter names `date_from`/`date_to` unchanged)
25
+ - **Markets response format**: `available.markets()` now returns `[{"name": "S&P 500", "region": "US"}, ...]` instead of `["S&P 500", ...]`
26
+
27
+ ### Added
28
+
29
+ - **News Endpoint**: `fb.news.ticker("AAPL")` — fetch news articles with sentiment scores (`/news/{SYMBOL}`)
30
+ - **Screener Endpoints**: `fb.screener.*` — cross-ticker screening with 11 methods:
31
+ - `sentiment()`, `analyst_ratings()`, `insider_trading()`, `congress_house()`, `congress_senate()`, `news()`, `put_call_ratio()`, `linkedin()`, `app_ratings()`, `predictions_daily()`, `predictions_monthly()`
32
+ - **Recent Data Endpoints**: `fb.recent.news()`, `fb.recent.analyst_ratings()` — latest data across all tracked stocks
33
+ - **Regions Endpoint**: `fb.available.regions()` — markets grouped by region
34
+ - **`limit` parameter**: Added to all per-symbol endpoints and screener/recent endpoints
35
+ - **`RateLimitError` exception**: New exception for HTTP 429 responses
36
+ - **`error_code` and `error_details` attributes**: Added to `FinBrainError` for v2 structured error responses
37
+ - **`client.last_meta`**: Stores the `meta` object from the last API response (contains `timestamp`)
38
+ - **Async parity**: All new endpoints have full async counterparts
39
+ - **Envelope tests**: `tests/test_envelope.py` dedicated tests for v2 response handling
40
+ - **79 unit tests**: Comprehensive test coverage for all v2 endpoints
41
+
42
+ ### Changed
43
+
44
+ - **Base URL**: `https://api.finbrain.tech/v1/` → `https://api.finbrain.tech/v2/`
45
+ - **Error message extraction**: Updated to handle v2 error format `{"error": {"code": "...", "message": "..."}}`
46
+ - **Insider transactions date parsing**: Simplified from custom `"%b %d '%y"` format to standard ISO dates
47
+ - **All plotting methods**: Updated for v2 column names and removed `market` parameter
48
+
49
+ ## [0.1.8] - 2025-12-27
50
+
51
+ ### Added
52
+
53
+ - **Senate Trades Endpoint**: `fb.senate_trades.ticker()` - Fetch U.S. Senator trading activity (`/senatetrades/{MARKET}/{TICKER}`)
54
+ - **Senate Trades Plotting**: `fb.plot.senate_trades()` - Visualize Senator trades on price charts
55
+ - **Async Senate Trades**: Full async support via `AsyncSenateTradesAPI`
56
+ - **Python 3.14 Support**: Added to CI test matrix (now testing 3.9-3.14)
57
+ - **Senate Trades Tests**: `tests/test_senate_trades.py`
58
+
59
+ ## [0.1.7] - 2025-10-02
60
+
61
+ ### Added
62
+
63
+ - **Insider Transactions Plotting**: `fb.plot.insider_transactions()` - Overlay insider buy/sell markers on user-provided price charts
64
+ - **House Trades Plotting**: `fb.plot.house_trades()` - Visualize U.S. House member trades on price charts
65
+ - **Transaction Plotting Example**: `examples/transactions_plotting_example.py` demonstrating integration with various price data sources
66
+ - **Plotting Tests**: Extended `tests/test_plotting.py` with 8 new test cases for transaction plotting
67
+
68
+ ### Changed
69
+
70
+ - **Price Data Flexibility**: Plotting methods now auto-detect multiple price column formats (`close`, `Close`, `price`, `Price`, `adj_close`, `Adj Close`)
71
+ - **MultiIndex Support**: Transaction plotting methods now handle yfinance's MultiIndex column format (from `yf.download()`)
72
+ - **Timezone Handling**: Automatic timezone normalization to handle timezone-aware price data (e.g., from yfinance)
73
+
74
+ ### Fixed
75
+
76
+ - **Column Detection**: Fixed `KeyError` when house trades API returns `type` column instead of `transaction`
77
+ - **yfinance Compatibility**: Fixed price line not displaying when using `yf.download()` due to MultiIndex columns
78
+
79
+ ## [0.1.6] - 2025-10-02
80
+
81
+ ### Added
82
+
83
+ - **Async Support**: Full async/await implementation using `httpx`
84
+ - `AsyncFinBrainClient` with context manager support
85
+ - All 9 endpoints have async equivalents
86
+ - Install with: `pip install finbrain-python[async]`
87
+ - Example: `examples/async_example.py`
88
+ - **Python 3.13 Support**: Added to CI test matrix (now testing 3.9, 3.10, 3.11, 3.12, 3.13)
89
+ - **Async utilities module**: `src/finbrain/aio/endpoints/_utils.py`
90
+ - **Sync utilities module**: `src/finbrain/endpoints/_utils.py`
91
+ - **Plotting tests**: `tests/test_plotting.py`
92
+ - **Async client tests**: `tests/test_async_client.py`
93
+ - **Release guide**: `RELEASE.md` with tag conventions
94
+
95
+ ### Changed
96
+
97
+ - **Tag Convention**: Now using `v` prefix (e.g., `v0.1.6` instead of `0.1.6`)
98
+ - **GitHub Actions**: Updated to trigger on `v[0-9]*` tags
99
+ - **Code Deduplication**: Consolidated 12 duplicate `_to_datestr()` helpers into 2 utility modules
100
+ - **README**: Added async usage section with examples
101
+
102
+ ### Fixed
103
+
104
+ - **Plotting Error Handling**: `options()` method now raises clear `ValueError` for invalid `kind` parameter instead of `NameError`
105
+
106
+ ### Dependencies
107
+
108
+ - Added `httpx>=0.24` as optional dependency for async support
109
+ - Added `pytest-asyncio` as dev dependency
110
+
111
+ ## [0.1.5] - 2024-09-18
112
+
113
+ Previous releases...
114
+
115
+ ## [0.1.4] - 2024-06-25
116
+
117
+ Previous releases...
118
+
119
+ ## [0.1.3] - 2024-06-13
120
+
121
+ Previous releases...
122
+
123
+ ## [0.1.2] - 2024-06-13
124
+
125
+ Previous releases...
126
+
127
+ ## [0.1.1] - 2024-06-13
128
+
129
+ Previous releases...
130
+
131
+ [0.2.0]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.1.8...v0.2.0
132
+ [0.1.8]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.1.7...v0.1.8
133
+ [0.1.7]: https://github.com/ahmetsbilgin/finbrain-python/compare/v0.1.6...v0.1.7
134
+ [0.1.6]: https://github.com/ahmetsbilgin/finbrain-python/compare/0.1.5...v0.1.6
135
+ [0.1.5]: https://github.com/ahmetsbilgin/finbrain-python/compare/0.1.4...0.1.5
136
+ [0.1.4]: https://github.com/ahmetsbilgin/finbrain-python/compare/0.1.3...0.1.4
137
+ [0.1.3]: https://github.com/ahmetsbilgin/finbrain-python/compare/0.1.2...0.1.3
138
+ [0.1.2]: https://github.com/ahmetsbilgin/finbrain-python/compare/0.1.1...0.1.2
139
+ [0.1.1]: https://github.com/ahmetsbilgin/finbrain-python/releases/tag/0.1.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finbrain-python
3
- Version: 0.1.7
3
+ Version: 0.2.0
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
@@ -30,8 +30,8 @@ Dynamic: license-file
30
30
  [![CI](https://github.com/ahmetsbilgin/finbrain-python/actions/workflows/ci.yml/badge.svg)](https://github.com/ahmetsbilgin/finbrain-python/actions/workflows/ci.yml)
31
31
  [![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
32
32
 
33
- **Official Python client** for the [FinBrain API](https://docs.finbrain.tech).
34
- Fetch deep-learning price predictions, sentiment scores, insider trades, LinkedIn metrics, options data and more — with a single import.
33
+ **Official Python client** for the [FinBrain API v2](https://docs.finbrain.tech).
34
+ Fetch deep-learning price predictions, sentiment scores, insider trades, LinkedIn metrics, options data, news and more — with a single import.
35
35
 
36
36
  *Python ≥ 3.9 • requests, pandas, numpy & plotly • asyncio optional.*
37
37
 
@@ -39,11 +39,11 @@ Fetch deep-learning price predictions, sentiment scores, insider trades, LinkedI
39
39
 
40
40
  ## ✨ Features
41
41
 
42
- - One-line auth (`FinBrainClient(api_key="…")`)
43
- - Complete endpoint coverage (predictions, sentiments, options, insider, etc.)
42
+ - One-line auth (`FinBrainClient(api_key="…")`) with Bearer token
43
+ - Complete v2 endpoint coverage (predictions, sentiments, options, insider, news, screener, etc.)
44
44
  - Transparent retries & custom error hierarchy (`FinBrainError`)
45
+ - Response envelope auto-unwrapping (v2 `{success, data, meta}` format)
45
46
  - Async parity with `finbrain.aio` (`httpx`)
46
- - CLI (`finbrain markets`, `finbrain predict AAPL`)
47
47
  - Auto-version from Git tags (setuptools-scm)
48
48
  - MIT-licensed, fully unit-tested
49
49
 
@@ -64,52 +64,70 @@ from finbrain import FinBrainClient
64
64
 
65
65
  fb = FinBrainClient(api_key="YOUR_KEY") # create once, reuse below
66
66
 
67
- # ---------- availability ----------
68
- fb.available.markets() # list markets
67
+ # ---------- discovery ----------
68
+ fb.available.markets() # list markets with regions
69
69
  fb.available.tickers("daily", as_dataframe=True)
70
+ fb.available.regions() # markets grouped by region
70
71
 
71
72
  # ---------- app ratings ----------
72
- fb.app_ratings.ticker("S&P 500", "AMZN",
73
+ fb.app_ratings.ticker("AMZN",
73
74
  date_from="2025-01-01",
74
75
  date_to="2025-06-30",
75
76
  as_dataframe=True)
76
77
 
77
78
  # ---------- analyst ratings ----------
78
- fb.analyst_ratings.ticker("S&P 500", "AMZN",
79
+ fb.analyst_ratings.ticker("AMZN",
79
80
  date_from="2025-01-01",
80
81
  date_to="2025-06-30",
81
82
  as_dataframe=True)
82
83
 
83
84
  # ---------- house trades ----------
84
- fb.house_trades.ticker("S&P 500", "AMZN",
85
+ fb.house_trades.ticker("AMZN",
85
86
  date_from="2025-01-01",
86
87
  date_to="2025-06-30",
87
88
  as_dataframe=True)
88
89
 
90
+ # ---------- senate trades ----------
91
+ fb.senate_trades.ticker("META",
92
+ date_from="2025-01-01",
93
+ date_to="2025-06-30",
94
+ as_dataframe=True)
95
+
89
96
  # ---------- insider transactions ----------
90
- fb.insider_transactions.ticker("S&P 500", "AMZN", as_dataframe=True)
97
+ fb.insider_transactions.ticker("AMZN", as_dataframe=True)
91
98
 
92
99
  # ---------- LinkedIn metrics ----------
93
- fb.linkedin_data.ticker("S&P 500", "AMZN",
100
+ fb.linkedin_data.ticker("AMZN",
94
101
  date_from="2025-01-01",
95
102
  date_to="2025-06-30",
96
103
  as_dataframe=True)
97
104
 
98
105
  # ---------- options put/call ----------
99
- fb.options.put_call("S&P 500", "AMZN",
106
+ fb.options.put_call("AMZN",
100
107
  date_from="2025-01-01",
101
108
  date_to="2025-06-30",
102
109
  as_dataframe=True)
103
110
 
104
111
  # ---------- price predictions ----------
105
- fb.predictions.market("S&P 500", as_dataframe=True) # all tickers in market
106
- fb.predictions.ticker("AMZN", as_dataframe=True) # single ticker
112
+ fb.predictions.ticker("AMZN", as_dataframe=True)
107
113
 
108
114
  # ---------- news sentiment ----------
109
- fb.sentiments.ticker("S&P 500", "AMZN",
115
+ fb.sentiments.ticker("AMZN",
110
116
  date_from="2025-01-01",
111
117
  date_to="2025-06-30",
112
118
  as_dataframe=True)
119
+
120
+ # ---------- news articles ----------
121
+ fb.news.ticker("AMZN", limit=20, as_dataframe=True)
122
+
123
+ # ---------- screener (cross-ticker) ----------
124
+ fb.screener.sentiment(market="S&P 500", as_dataframe=True)
125
+ fb.screener.predictions_daily(limit=100, as_dataframe=True)
126
+ fb.screener.insider_trading(limit=50)
127
+
128
+ # ---------- recent data ----------
129
+ fb.recent.news(limit=100, as_dataframe=True)
130
+ fb.recent.analyst_ratings(limit=50)
113
131
  ```
114
132
 
115
133
  ## ⚡ Async Usage
@@ -136,15 +154,17 @@ async def main():
136
154
 
137
155
  # Fetch sentiment data
138
156
  sentiment = await fb.sentiments.ticker(
139
- "S&P 500", "AMZN",
157
+ "AMZN",
140
158
  date_from="2025-01-01",
141
159
  date_to="2025-06-30",
142
160
  as_dataframe=True
143
161
  )
144
162
 
145
163
  # All other endpoints work the same way
146
- app_ratings = await fb.app_ratings.ticker("S&P 500", "AMZN", as_dataframe=True)
147
- analyst_ratings = await fb.analyst_ratings.ticker("S&P 500", "AMZN", as_dataframe=True)
164
+ app_ratings = await fb.app_ratings.ticker("AMZN", as_dataframe=True)
165
+ analyst_ratings = await fb.analyst_ratings.ticker("AMZN", as_dataframe=True)
166
+ news = await fb.news.ticker("AMZN", limit=10)
167
+ screener = await fb.screener.sentiment(market="S&P 500")
148
168
 
149
169
  asyncio.run(main())
150
170
  ```
@@ -161,18 +181,18 @@ Plot helpers in a nutshell
161
181
 
162
182
  ```python
163
183
  # ---------- App Ratings Chart - Apple App Store or Google Play Store ----------
164
- fb.plot.app_ratings("S&P 500", "AMZN",
184
+ fb.plot.app_ratings("AMZN",
165
185
  store="app", # "play" for Google Play Store
166
186
  date_from="2025-01-01",
167
187
  date_to="2025-06-30")
168
188
 
169
189
  # ---------- LinkedIn Metrics Chart ----------
170
- fb.plot.linkedin("S&P 500", "AMZN",
190
+ fb.plot.linkedin("AMZN",
171
191
  date_from="2025-01-01",
172
192
  date_to="2025-06-30")
173
193
 
174
194
  # ---------- Put-Call Ratio Chart ----------
175
- fb.plot.options("S&P 500", "AMZN",
195
+ fb.plot.options("AMZN",
176
196
  kind="put_call",
177
197
  date_from="2025-01-01",
178
198
  date_to="2025-06-30")
@@ -181,11 +201,11 @@ fb.plot.options("S&P 500", "AMZN",
181
201
  fb.plot.predictions("AMZN") # prediction_type="monthly" for monthly predictions
182
202
 
183
203
  # ---------- Sentiments Chart ----------
184
- fb.plot.sentiments("S&P 500", "AMZN",
204
+ fb.plot.sentiments("AMZN",
185
205
  date_from="2025-01-01",
186
206
  date_to="2025-06-30")
187
207
 
188
- # ---------- Insider Transactions & House Trades (requires user price data) ----------
208
+ # ---------- Insider Transactions, House & Senate Trades (requires user price data) ----------
189
209
  # These plots overlay transaction markers on a price chart.
190
210
  # Since FinBrain doesn't provide historical prices, you must provide your own:
191
211
 
@@ -199,13 +219,19 @@ price_df = pd.DataFrame({
199
219
  }).set_index("date")
200
220
 
201
221
  # Plot insider transactions on your price chart
202
- fb.plot.insider_transactions("S&P 500", "AAPL", price_data=price_df)
222
+ fb.plot.insider_transactions("AAPL", price_data=price_df)
203
223
 
204
224
  # Plot House member trades on your price chart
205
- fb.plot.house_trades("S&P 500", "NVDA",
225
+ fb.plot.house_trades("NVDA",
206
226
  price_data=price_df,
207
227
  date_from="2025-01-01",
208
228
  date_to="2025-06-30")
229
+
230
+ # Plot Senate member trades on your price chart
231
+ fb.plot.senate_trades("META",
232
+ price_data=price_df,
233
+ date_from="2025-01-01",
234
+ date_to="2025-06-30")
209
235
  ```
210
236
 
211
237
  **Price Data Requirements:**
@@ -216,7 +242,7 @@ fb.plot.house_trades("S&P 500", "NVDA",
216
242
 
217
243
  ## 🔑 Authentication
218
244
 
219
- To call the API you need an **API key**, obtained by purchasing a **FinBrain API subscription**.
245
+ To call the API you need an **API key**, obtained by purchasing a **FinBrain API subscription**.
220
246
  *(The Terminal-only subscription does **not** include an API key.)*
221
247
 
222
248
  1. Subscribe at <https://www.finbrain.tech> → FinBrain API.
@@ -228,23 +254,37 @@ from finbrain import FinBrainClient
228
254
  fb = FinBrainClient(api_key="YOUR_KEY")
229
255
  ```
230
256
 
257
+ Or set the `FINBRAIN_API_KEY` environment variable and omit the argument:
258
+
259
+ ```python
260
+ fb = FinBrainClient() # reads from FINBRAIN_API_KEY env var
261
+ ```
262
+
231
263
  ---
232
264
 
233
265
  ## 📚 Supported endpoints
234
266
 
235
- | Category | Method | Path |
236
- |----------------------|------------------------------------------|------------------------------------------------------|
237
- | Availability | `client.available.markets()` | `/available/markets` |
238
- | | `client.available.tickers()` | `/available/tickers/{TYPE}` |
239
- | Predictions | `client.predictions.ticker()` | `/ticker/{TICKER}/predictions/{daily\|monthly}` |
240
- | | `client.predictions.market()` | `/market/{MARKET}/predictions/{daily\|monthly}` |
241
- | Sentiments | `client.sentiments.ticker()` | `/sentiments/{MARKET}/{TICKER}` |
242
- | App ratings | `client.app_ratings.ticker()` | `/appratings/{MARKET}/{TICKER}` |
243
- | Analyst ratings | `client.analyst_ratings.ticker()` | `/analystratings/{MARKET}/{TICKER}` |
244
- | House trades | `client.house_trades.ticker()` | `/housetrades/{MARKET}/{TICKER}` |
245
- | Insider transactions | `client.insider_transactions.ticker()` | `/insidertransactions/{MARKET}/{TICKER}` |
246
- | LinkedIn | `client.linkedin_data.ticker()` | `/linkedindata/{MARKET}/{TICKER}` |
247
- | Options Put/Call | `client.options.put_call()` | `/putcalldata/{MARKET}/{TICKER}` |
267
+ | Category | Method | v2 Path |
268
+ |----------------------|------------------------------------------|---------------------------------------------|
269
+ | Discovery | `client.available.markets()` | `/markets` |
270
+ | | `client.available.tickers()` | `/tickers` |
271
+ | | `client.available.regions()` | `/regions` |
272
+ | Predictions | `client.predictions.ticker()` | `/predictions/{daily\|monthly}/{SYMBOL}` |
273
+ | Sentiments | `client.sentiments.ticker()` | `/sentiment/{SYMBOL}` |
274
+ | News | `client.news.ticker()` | `/news/{SYMBOL}` |
275
+ | App ratings | `client.app_ratings.ticker()` | `/app-ratings/{SYMBOL}` |
276
+ | Analyst ratings | `client.analyst_ratings.ticker()` | `/analyst-ratings/{SYMBOL}` |
277
+ | House trades | `client.house_trades.ticker()` | `/congress/house/{SYMBOL}` |
278
+ | Senate trades | `client.senate_trades.ticker()` | `/congress/senate/{SYMBOL}` |
279
+ | Insider transactions | `client.insider_transactions.ticker()` | `/insider-trading/{SYMBOL}` |
280
+ | LinkedIn | `client.linkedin_data.ticker()` | `/linkedin/{SYMBOL}` |
281
+ | Options – Put/Call | `client.options.put_call()` | `/put-call-ratio/{SYMBOL}` |
282
+ | Screener | `client.screener.sentiment()` | `/screener/sentiment` |
283
+ | | `client.screener.predictions_daily()` | `/screener/predictions/daily` |
284
+ | | `client.screener.insider_trading()` | `/screener/insider-trading` |
285
+ | | ... and 8 more screener methods | |
286
+ | Recent | `client.recent.news()` | `/recent/news` |
287
+ | | `client.recent.analyst_ratings()` | `/recent/analyst-ratings` |
248
288
 
249
289
  ---
250
290
 
@@ -256,6 +296,8 @@ try:
256
296
  fb.predictions.ticker("MSFT", prediction_type="weekly")
257
297
  except BadRequest as exc:
258
298
  print("Invalid parameters:", exc)
299
+ print("Error code:", exc.error_code) # e.g. "VALIDATION_ERROR"
300
+ print("Details:", exc.error_details) # structured details dict
259
301
  ```
260
302
 
261
303
  | HTTP status | Exception class | Meaning |
@@ -265,6 +307,7 @@ except BadRequest as exc:
265
307
  | 403 | `PermissionDenied` | Authenticated, but not authorised |
266
308
  | 404 | `NotFound` | Resource or endpoint not found |
267
309
  | 405 | `MethodNotAllowed` | HTTP method not supported on endpoint |
310
+ | 429 | `RateLimitError` | Too many requests |
268
311
  | 500 | `ServerError` | FinBrain internal error |
269
312
 
270
313
  ---
@@ -276,7 +319,7 @@ except BadRequest as exc:
276
319
  - Version auto-generated from Git tags (setuptools-scm)
277
320
 
278
321
  ```bash
279
- git tag -a v0.2.0 -m "Add options.chain endpoint"
322
+ git tag -a v0.2.0 -m "v2 API migration"
280
323
  git push --tags # GitHub Actions builds & uploads to PyPI
281
324
  ```
282
325
 
@@ -291,15 +334,7 @@ python -m venv .venv && source .venv/bin/activate
291
334
  pip install -e .[dev]
292
335
 
293
336
  ruff check . # lint / format
294
- pytest -q # unit tests (mocked)
295
- ```
296
-
297
- ### Live integration test(currently under development)
298
-
299
- Set `FINBRAIN_LIVE_KEY`, then run:
300
-
301
- ```bash
302
- pytest -m integration
337
+ pytest -q # unit tests (mocked)
303
338
  ```
304
339
 
305
340
  ---
@@ -308,7 +343,7 @@ pytest -m integration
308
343
 
309
344
  1. Fork → create a feature branch
310
345
 
311
- 2. Add tests & run `ruff --fix`
346
+ 2. Add tests & run `ruff check --fix`
312
347
 
313
348
  3. Ensure `pytest` & CI pass
314
349
 
@@ -318,7 +353,7 @@ pytest -m integration
318
353
 
319
354
  ## 🔒 Security
320
355
 
321
- Please report vulnerabilities to **<info@finbrain.tech>**.
356
+ Please report vulnerabilities to **<info@finbrain.tech>**.
322
357
  We respond within 48 hours.
323
358
 
324
359
  ---
@@ -329,4 +364,4 @@ MIT — see [LICENSE](LICENSE).
329
364
 
330
365
  ---
331
366
 
332
- © 2025 FinBrain Technologies — Built with ❤️ for the quant community.
367
+ © 2026 FinBrain Technologies — Built with ❤️ for the quant community.