finbrain-python 0.1.8__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 (92) hide show
  1. finbrain_python-0.2.0/CHANGELOG.md +139 -0
  2. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/PKG-INFO +78 -56
  3. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/README.md +77 -55
  4. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/examples/async_example.py +0 -1
  5. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/examples/transactions_plotting_example.py +1 -4
  6. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/pyproject.toml +5 -0
  7. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/client.py +25 -8
  8. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/analyst_ratings.py +9 -9
  9. finbrain_python-0.2.0/src/finbrain/aio/endpoints/app_ratings.py +66 -0
  10. finbrain_python-0.2.0/src/finbrain/aio/endpoints/available.py +73 -0
  11. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/house_trades.py +9 -9
  12. finbrain_python-0.2.0/src/finbrain/aio/endpoints/insider_transactions.py +47 -0
  13. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/linkedin_data.py +8 -8
  14. finbrain_python-0.2.0/src/finbrain/aio/endpoints/news.py +47 -0
  15. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/options.py +8 -8
  16. finbrain_python-0.2.0/src/finbrain/aio/endpoints/predictions.py +45 -0
  17. finbrain_python-0.2.0/src/finbrain/aio/endpoints/recent.py +72 -0
  18. finbrain_python-0.2.0/src/finbrain/aio/endpoints/screener.py +210 -0
  19. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/senate_trades.py +10 -10
  20. finbrain_python-0.2.0/src/finbrain/aio/endpoints/sentiments.py +51 -0
  21. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/client.py +22 -7
  22. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/analyst_ratings.py +11 -16
  23. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/app_ratings.py +53 -25
  24. finbrain_python-0.2.0/src/finbrain/endpoints/available.py +131 -0
  25. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/house_trades.py +12 -15
  26. finbrain_python-0.2.0/src/finbrain/endpoints/insider_transactions.py +73 -0
  27. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/linkedin_data.py +10 -16
  28. finbrain_python-0.2.0/src/finbrain/endpoints/news.py +68 -0
  29. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/options.py +11 -14
  30. finbrain_python-0.2.0/src/finbrain/endpoints/predictions.py +70 -0
  31. finbrain_python-0.2.0/src/finbrain/endpoints/recent.py +106 -0
  32. finbrain_python-0.2.0/src/finbrain/endpoints/screener.py +215 -0
  33. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/senate_trades.py +13 -16
  34. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/sentiments.py +21 -34
  35. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/exceptions.py +40 -8
  36. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/plotting.py +31 -51
  37. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/PKG-INFO +78 -56
  38. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/SOURCES.txt +11 -0
  39. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/tests/conftest.py +19 -7
  40. finbrain_python-0.2.0/tests/test_analyst_ratings.py +88 -0
  41. finbrain_python-0.2.0/tests/test_app_ratings.py +81 -0
  42. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/tests/test_available.py +28 -20
  43. finbrain_python-0.2.0/tests/test_envelope.py +109 -0
  44. finbrain_python-0.2.0/tests/test_house_trades.py +87 -0
  45. finbrain_python-0.2.0/tests/test_insider_transactions.py +97 -0
  46. finbrain_python-0.2.0/tests/test_integration.py +409 -0
  47. finbrain_python-0.2.0/tests/test_linkedin_data.py +85 -0
  48. finbrain_python-0.2.0/tests/test_news.py +66 -0
  49. finbrain_python-0.2.0/tests/test_options.py +91 -0
  50. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/tests/test_plotting.py +14 -18
  51. finbrain_python-0.2.0/tests/test_predictions.py +79 -0
  52. finbrain_python-0.2.0/tests/test_recent.py +66 -0
  53. finbrain_python-0.2.0/tests/test_screener.py +314 -0
  54. finbrain_python-0.2.0/tests/test_senate_trades.py +87 -0
  55. finbrain_python-0.2.0/tests/test_sentiments.py +93 -0
  56. finbrain_python-0.1.8/CHANGELOG.md +0 -89
  57. finbrain_python-0.1.8/src/finbrain/aio/endpoints/app_ratings.py +0 -49
  58. finbrain_python-0.1.8/src/finbrain/aio/endpoints/available.py +0 -41
  59. finbrain_python-0.1.8/src/finbrain/aio/endpoints/insider_transactions.py +0 -40
  60. finbrain_python-0.1.8/src/finbrain/aio/endpoints/predictions.py +0 -85
  61. finbrain_python-0.1.8/src/finbrain/aio/endpoints/sentiments.py +0 -55
  62. finbrain_python-0.1.8/src/finbrain/endpoints/available.py +0 -83
  63. finbrain_python-0.1.8/src/finbrain/endpoints/insider_transactions.py +0 -68
  64. finbrain_python-0.1.8/src/finbrain/endpoints/predictions.py +0 -130
  65. finbrain_python-0.1.8/tests/test_analyst_ratings.py +0 -88
  66. finbrain_python-0.1.8/tests/test_app_ratings.py +0 -56
  67. finbrain_python-0.1.8/tests/test_house_trades.py +0 -76
  68. finbrain_python-0.1.8/tests/test_insider_transactions.py +0 -82
  69. finbrain_python-0.1.8/tests/test_linkedin_data.py +0 -61
  70. finbrain_python-0.1.8/tests/test_options.py +0 -76
  71. finbrain_python-0.1.8/tests/test_predictions.py +0 -126
  72. finbrain_python-0.1.8/tests/test_senate_trades.py +0 -76
  73. finbrain_python-0.1.8/tests/test_sentiments.py +0 -86
  74. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/.gitattributes +0 -0
  75. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/.github/workflows/ci.yml +0 -0
  76. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/.github/workflows/release.yml +0 -0
  77. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/.gitignore +0 -0
  78. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/LICENSE +0 -0
  79. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/RELEASE.md +0 -0
  80. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/setup.cfg +0 -0
  81. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/__init__.py +0 -0
  82. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/__init__.py +0 -0
  83. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/__init__.py +0 -0
  84. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/aio/endpoints/_utils.py +0 -0
  85. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/__init__.py +0 -0
  86. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/endpoints/_utils.py +0 -0
  87. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain/py.typed +0 -0
  88. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/dependency_links.txt +0 -0
  89. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/requires.txt +0 -0
  90. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/src/finbrain_python.egg-info/top_level.txt +0 -0
  91. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/tests/__init__.py +0 -0
  92. {finbrain_python-0.1.8 → finbrain_python-0.2.0}/tests/test_async_client.py +0 -0
@@ -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.8
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,58 +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
 
89
90
  # ---------- senate trades ----------
90
- fb.senate_trades.ticker("NASDAQ", "META",
91
+ fb.senate_trades.ticker("META",
91
92
  date_from="2025-01-01",
92
93
  date_to="2025-06-30",
93
94
  as_dataframe=True)
94
95
 
95
96
  # ---------- insider transactions ----------
96
- fb.insider_transactions.ticker("S&P 500", "AMZN", as_dataframe=True)
97
+ fb.insider_transactions.ticker("AMZN", as_dataframe=True)
97
98
 
98
99
  # ---------- LinkedIn metrics ----------
99
- fb.linkedin_data.ticker("S&P 500", "AMZN",
100
+ fb.linkedin_data.ticker("AMZN",
100
101
  date_from="2025-01-01",
101
102
  date_to="2025-06-30",
102
103
  as_dataframe=True)
103
104
 
104
105
  # ---------- options put/call ----------
105
- fb.options.put_call("S&P 500", "AMZN",
106
+ fb.options.put_call("AMZN",
106
107
  date_from="2025-01-01",
107
108
  date_to="2025-06-30",
108
109
  as_dataframe=True)
109
110
 
110
111
  # ---------- price predictions ----------
111
- fb.predictions.market("S&P 500", as_dataframe=True) # all tickers in market
112
- fb.predictions.ticker("AMZN", as_dataframe=True) # single ticker
112
+ fb.predictions.ticker("AMZN", as_dataframe=True)
113
113
 
114
114
  # ---------- news sentiment ----------
115
- fb.sentiments.ticker("S&P 500", "AMZN",
115
+ fb.sentiments.ticker("AMZN",
116
116
  date_from="2025-01-01",
117
117
  date_to="2025-06-30",
118
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)
119
131
  ```
120
132
 
121
133
  ## ⚡ Async Usage
@@ -142,15 +154,17 @@ async def main():
142
154
 
143
155
  # Fetch sentiment data
144
156
  sentiment = await fb.sentiments.ticker(
145
- "S&P 500", "AMZN",
157
+ "AMZN",
146
158
  date_from="2025-01-01",
147
159
  date_to="2025-06-30",
148
160
  as_dataframe=True
149
161
  )
150
162
 
151
163
  # All other endpoints work the same way
152
- app_ratings = await fb.app_ratings.ticker("S&P 500", "AMZN", as_dataframe=True)
153
- 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")
154
168
 
155
169
  asyncio.run(main())
156
170
  ```
@@ -167,18 +181,18 @@ Plot helpers in a nutshell
167
181
 
168
182
  ```python
169
183
  # ---------- App Ratings Chart - Apple App Store or Google Play Store ----------
170
- fb.plot.app_ratings("S&P 500", "AMZN",
184
+ fb.plot.app_ratings("AMZN",
171
185
  store="app", # "play" for Google Play Store
172
186
  date_from="2025-01-01",
173
187
  date_to="2025-06-30")
174
188
 
175
189
  # ---------- LinkedIn Metrics Chart ----------
176
- fb.plot.linkedin("S&P 500", "AMZN",
190
+ fb.plot.linkedin("AMZN",
177
191
  date_from="2025-01-01",
178
192
  date_to="2025-06-30")
179
193
 
180
194
  # ---------- Put-Call Ratio Chart ----------
181
- fb.plot.options("S&P 500", "AMZN",
195
+ fb.plot.options("AMZN",
182
196
  kind="put_call",
183
197
  date_from="2025-01-01",
184
198
  date_to="2025-06-30")
@@ -187,7 +201,7 @@ fb.plot.options("S&P 500", "AMZN",
187
201
  fb.plot.predictions("AMZN") # prediction_type="monthly" for monthly predictions
188
202
 
189
203
  # ---------- Sentiments Chart ----------
190
- fb.plot.sentiments("S&P 500", "AMZN",
204
+ fb.plot.sentiments("AMZN",
191
205
  date_from="2025-01-01",
192
206
  date_to="2025-06-30")
193
207
 
@@ -205,16 +219,16 @@ price_df = pd.DataFrame({
205
219
  }).set_index("date")
206
220
 
207
221
  # Plot insider transactions on your price chart
208
- fb.plot.insider_transactions("S&P 500", "AAPL", price_data=price_df)
222
+ fb.plot.insider_transactions("AAPL", price_data=price_df)
209
223
 
210
224
  # Plot House member trades on your price chart
211
- fb.plot.house_trades("S&P 500", "NVDA",
225
+ fb.plot.house_trades("NVDA",
212
226
  price_data=price_df,
213
227
  date_from="2025-01-01",
214
228
  date_to="2025-06-30")
215
229
 
216
230
  # Plot Senate member trades on your price chart
217
- fb.plot.senate_trades("NASDAQ", "META",
231
+ fb.plot.senate_trades("META",
218
232
  price_data=price_df,
219
233
  date_from="2025-01-01",
220
234
  date_to="2025-06-30")
@@ -228,7 +242,7 @@ fb.plot.senate_trades("NASDAQ", "META",
228
242
 
229
243
  ## 🔑 Authentication
230
244
 
231
- 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**.
232
246
  *(The Terminal-only subscription does **not** include an API key.)*
233
247
 
234
248
  1. Subscribe at <https://www.finbrain.tech> → FinBrain API.
@@ -240,24 +254,37 @@ from finbrain import FinBrainClient
240
254
  fb = FinBrainClient(api_key="YOUR_KEY")
241
255
  ```
242
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
+
243
263
  ---
244
264
 
245
265
  ## 📚 Supported endpoints
246
266
 
247
- | Category | Method | Path |
248
- |----------------------|------------------------------------------|------------------------------------------------------|
249
- | Availability | `client.available.markets()` | `/available/markets` |
250
- | | `client.available.tickers()` | `/available/tickers/{TYPE}` |
251
- | Predictions | `client.predictions.ticker()` | `/ticker/{TICKER}/predictions/{daily\|monthly}` |
252
- | | `client.predictions.market()` | `/market/{MARKET}/predictions/{daily\|monthly}` |
253
- | Sentiments | `client.sentiments.ticker()` | `/sentiments/{MARKET}/{TICKER}` |
254
- | App ratings | `client.app_ratings.ticker()` | `/appratings/{MARKET}/{TICKER}` |
255
- | Analyst ratings | `client.analyst_ratings.ticker()` | `/analystratings/{MARKET}/{TICKER}` |
256
- | House trades | `client.house_trades.ticker()` | `/housetrades/{MARKET}/{TICKER}` |
257
- | Senate trades | `client.senate_trades.ticker()` | `/senatetrades/{MARKET}/{TICKER}` |
258
- | Insider transactions | `client.insider_transactions.ticker()` | `/insidertransactions/{MARKET}/{TICKER}` |
259
- | LinkedIn | `client.linkedin_data.ticker()` | `/linkedindata/{MARKET}/{TICKER}` |
260
- | 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` |
261
288
 
262
289
  ---
263
290
 
@@ -269,6 +296,8 @@ try:
269
296
  fb.predictions.ticker("MSFT", prediction_type="weekly")
270
297
  except BadRequest as exc:
271
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
272
301
  ```
273
302
 
274
303
  | HTTP status | Exception class | Meaning |
@@ -278,6 +307,7 @@ except BadRequest as exc:
278
307
  | 403 | `PermissionDenied` | Authenticated, but not authorised |
279
308
  | 404 | `NotFound` | Resource or endpoint not found |
280
309
  | 405 | `MethodNotAllowed` | HTTP method not supported on endpoint |
310
+ | 429 | `RateLimitError` | Too many requests |
281
311
  | 500 | `ServerError` | FinBrain internal error |
282
312
 
283
313
  ---
@@ -289,7 +319,7 @@ except BadRequest as exc:
289
319
  - Version auto-generated from Git tags (setuptools-scm)
290
320
 
291
321
  ```bash
292
- git tag -a v0.2.0 -m "Add options.chain endpoint"
322
+ git tag -a v0.2.0 -m "v2 API migration"
293
323
  git push --tags # GitHub Actions builds & uploads to PyPI
294
324
  ```
295
325
 
@@ -304,15 +334,7 @@ python -m venv .venv && source .venv/bin/activate
304
334
  pip install -e .[dev]
305
335
 
306
336
  ruff check . # lint / format
307
- pytest -q # unit tests (mocked)
308
- ```
309
-
310
- ### Live integration test(currently under development)
311
-
312
- Set `FINBRAIN_LIVE_KEY`, then run:
313
-
314
- ```bash
315
- pytest -m integration
337
+ pytest -q # unit tests (mocked)
316
338
  ```
317
339
 
318
340
  ---
@@ -321,7 +343,7 @@ pytest -m integration
321
343
 
322
344
  1. Fork → create a feature branch
323
345
 
324
- 2. Add tests & run `ruff --fix`
346
+ 2. Add tests & run `ruff check --fix`
325
347
 
326
348
  3. Ensure `pytest` & CI pass
327
349
 
@@ -331,7 +353,7 @@ pytest -m integration
331
353
 
332
354
  ## 🔒 Security
333
355
 
334
- Please report vulnerabilities to **<info@finbrain.tech>**.
356
+ Please report vulnerabilities to **<info@finbrain.tech>**.
335
357
  We respond within 48 hours.
336
358
 
337
359
  ---
@@ -342,4 +364,4 @@ MIT — see [LICENSE](LICENSE).
342
364
 
343
365
  ---
344
366
 
345
- © 2025 FinBrain Technologies — Built with ❤️ for the quant community.
367
+ © 2026 FinBrain Technologies — Built with ❤️ for the quant community.