finbrain-python 0.1.1__py3-none-any.whl

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.
@@ -0,0 +1,238 @@
1
+ Metadata-Version: 2.4
2
+ Name: finbrain-python
3
+ Version: 0.1.1
4
+ Summary: Official Python client for the FinBrain API
5
+ Author-email: Ahmet Salim Bilgin <ahmet@finbrain.tech>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: requests>=2.31
11
+ Requires-Dist: typer[all]>=0.12
12
+ Requires-Dist: pandas>=2.2
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest; extra == "dev"
15
+ Requires-Dist: responses; extra == "dev"
16
+ Requires-Dist: build; extra == "dev"
17
+ Requires-Dist: twine; extra == "dev"
18
+ Requires-Dist: ruff; extra == "dev"
19
+ Dynamic: license-file
20
+
21
+ # FinBrain Python SDK&nbsp;<!-- omit in toc -->
22
+
23
+ [![PyPI version](https://img.shields.io/pypi/v/finbrain-python.svg)](https://pypi.org/project/finbrain-python/)
24
+ [![CI](https://github.com/finbrain-tech/finbrain-python/actions/workflows/ci.yml/badge.svg)](https://github.com/finbrain-tech/finbrain-python/actions/workflows/ci.yml)
25
+ [![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
26
+
27
+ **Official Python client** for the [FinBrain API](https://docs.finbrain.tech).
28
+ Fetch deep-learning price predictions, sentiment scores, insider trades, LinkedIn metrics, options data and more — with a single import.
29
+
30
+ *Python ≥ 3.9 • requests & pandas • asyncio optional.*
31
+
32
+ ---
33
+
34
+ ## ✨ Features
35
+ - One-line auth (`FinBrainClient(api_key="…")`)
36
+ - Complete endpoint coverage (predictions, sentiments, options, insider, etc.)
37
+ - Transparent retries & custom error hierarchy (`FinBrainError`)
38
+ - Async parity with `finbrain.aio` (`httpx`)
39
+ - CLI (`finbrain markets`, `finbrain predict AAPL`)
40
+ - Auto-version from Git tags (setuptools-scm)
41
+ - MIT-licensed, fully unit-tested
42
+
43
+ ---
44
+
45
+ ## 🚀 Quick start
46
+ Install the SDK:
47
+ ```
48
+ pip install finbrain-python
49
+ ```
50
+ Create a client and fetch data:
51
+ ```
52
+ from finbrain import FinBrainClient
53
+
54
+ fb = FinBrainClient(api_key="YOUR_KEY") # create once, reuse below
55
+
56
+ # ---------- availability ----------
57
+ fb.available.markets() # list markets
58
+ fb.available.tickers("daily", as_dataframe=True)
59
+
60
+ # ---------- app ratings ----------
61
+ fb.app_ratings.ticker("S&P 500", "AMZN",
62
+ date_from="2025-01-01",
63
+ date_to="2025-05-31",
64
+ as_dataframe=True)
65
+
66
+ # ---------- analyst ratings ----------
67
+ fb.analyst_ratings.ticker("S&P 500", "AMZN",
68
+ date_from="2025-01-01",
69
+ date_to="2025-05-31",
70
+ as_dataframe=True)
71
+
72
+ # ---------- house trades ----------
73
+ fb.house_trades.ticker("S&P 500", "AMZN",
74
+ date_from="2025-01-01",
75
+ date_to="2025-05-31",
76
+ as_dataframe=True)
77
+
78
+ # ---------- insider transactions ----------
79
+ fb.insider_transactions.ticker("S&P 500", "AMZN", as_dataframe=True)
80
+
81
+ # ---------- LinkedIn metrics ----------
82
+ fb.linkedin_data.ticker("S&P 500", "AMZN",
83
+ date_from="2025-01-01",
84
+ date_to="2025-05-31",
85
+ as_dataframe=True)
86
+
87
+ # ---------- options put/call ----------
88
+ fb.options.put_call("S&P 500", "AMZN",
89
+ date_from="2025-01-01",
90
+ date_to="2025-05-31",
91
+ as_dataframe=True)
92
+
93
+ # ---------- price predictions ----------
94
+ fb.predictions.market("S&P 500", as_dataframe=True) # all tickers in market
95
+ fb.predictions.ticker("AMZN", as_dataframe=True) # single ticker
96
+
97
+ # ---------- news sentiment ----------
98
+ fb.sentiments.ticker("S&P 500", "AMZN",
99
+ date_from="2025-01-01",
100
+ date_to="2025-05-31",
101
+ as_dataframe=True)
102
+ ```
103
+
104
+ ## 🔑 Authentication
105
+
106
+ To call the API you need an **API key**, obtained by purchasing a **FinBrain API subscription**.
107
+ *(The Terminal-only subscription does **not** include an API key.)*
108
+
109
+ 1. Subscribe at <https://www.finbrain.tech> → FinBrain API.
110
+ 2. Copy the key from your dashboard.
111
+ 3. Pass it once when you create the client:
112
+
113
+ ```
114
+ from finbrain import FinBrainClient
115
+ fb = FinBrainClient(api_key="YOUR_KEY")
116
+ ```
117
+
118
+ ### Async(currently under development)
119
+
120
+ ```
121
+ import asyncio, os
122
+ from finbrain.aio import FinBrainAsyncClient async
123
+ def main():
124
+ async with FinBrainAsyncClient(api_key=os.getenv("FINBRAIN_API_KEY")) as fb:
125
+ data = await fb.sentiments.ticker("sp500", "AMZN")
126
+ print(list(data["sentimentAnalysis"].items())[:3])
127
+
128
+ asyncio.run(main())`
129
+ ```
130
+
131
+ ### CLI(currently under development)
132
+
133
+ ```
134
+ export FINBRAIN_API_KEY=your_key
135
+ finbrain markets
136
+ finbrain predict AAPL --type daily
137
+ ```
138
+
139
+ ----------
140
+
141
+ ## 📚 Supported endpoints
142
+
143
+ | Category | Method | Path |
144
+ |----------------------|------------------------------------------|------------------------------------------------------|
145
+ | Availability | `client.available.markets()` | `/available/markets` |
146
+ | | `client.available.tickers()` | `/available/tickers/{TYPE}` |
147
+ | Predictions | `client.predictions.ticker()` | `/ticker/{TICKER}/predictions/{daily\|monthly}` |
148
+ | | `client.predictions.market()` | `/market/{MARKET}/predictions/{daily\|monthly}` |
149
+ | Sentiments | `client.sentiments.ticker()` | `/sentiments/{MARKET}/{TICKER}` |
150
+ | App ratings | `client.app_ratings.ticker()` | `/appratings/{MARKET}/{TICKER}` |
151
+ | Analyst ratings | `client.analyst_ratings.ticker()` | `/analystratings/{MARKET}/{TICKER}` |
152
+ | House trades | `client.house_trades.ticker()` | `/housetrades/{MARKET}/{TICKER}` |
153
+ | Insider transactions | `client.insider_transactions.ticker()` | `/insidertransactions/{MARKET}/{TICKER}` |
154
+ | LinkedIn | `client.linkedin_data.ticker()` | `/linkedindata/{MARKET}/{TICKER}` |
155
+ | Options – Put/Call | `client.options.put_call()` | `/putcalldata/{MARKET}/{TICKER}` |
156
+
157
+ ----------
158
+
159
+ ## 🛠️ Error-handling
160
+
161
+ ```
162
+ from finbrain.exceptions import BadRequest
163
+ try:
164
+ fb.predictions.ticker("MSFT", prediction_type="weekly")
165
+ except BadRequest as exc:
166
+ print("Invalid parameters:", exc)`
167
+ ```
168
+
169
+ | HTTP status | Exception class | Meaning |
170
+ |-------------|--------------------------|---------------------------------------|
171
+ | 400 | `BadRequest` | The request is invalid or malformed |
172
+ | 401 | `AuthenticationError` | API key missing or incorrect |
173
+ | 403 | `PermissionDenied` | Authenticated, but not authorised |
174
+ | 404 | `NotFound` | Resource or endpoint not found |
175
+ | 405 | `MethodNotAllowed` | HTTP method not supported on endpoint |
176
+ | 500 | `ServerError` | FinBrain internal error |
177
+
178
+ ----------
179
+
180
+ ## 🔄 Versioning & release
181
+
182
+ - Semantic Versioning (`MAJOR.MINOR.PATCH`)
183
+
184
+ - Version auto-generated from Git tags (setuptools-scm)
185
+
186
+ ```
187
+ git tag -a v0.2.0 -m "Add options.chain endpoint"
188
+ git push --tags # GitHub Actions builds & uploads to PyPI
189
+ ```
190
+
191
+ ----------
192
+
193
+ ## 🧑‍💻 Development
194
+
195
+ ```
196
+ git clone https://github.com/finbrain-tech/finbrain-python cd finbrain-python
197
+ python -m venv .venv && source .venv/bin/activate
198
+ pip install -e .[dev]
199
+
200
+ ruff check . # lint / format pytest -q # unit tests (mocked)
201
+ ```
202
+
203
+ ### Live integration test(currently under development)
204
+
205
+ Set `FINBRAIN_LIVE_KEY`, then run:
206
+
207
+ ```
208
+ pytest -m integration
209
+ ```
210
+ ----------
211
+
212
+ ## 🤝 Contributing
213
+
214
+ 1. Fork → create a feature branch
215
+
216
+ 2. Add tests & run `ruff --fix`
217
+
218
+ 3. Ensure `pytest` & CI pass
219
+
220
+ 4. Open a PR — thanks!
221
+
222
+
223
+ ----------
224
+
225
+ ## 🔒 Security
226
+
227
+ Please report vulnerabilities to **info@finbrain.tech**.
228
+ We respond within 48 hours.
229
+
230
+ ----------
231
+
232
+ ## 📜 License
233
+
234
+ MIT — see [LICENSE](LICENSE).
235
+
236
+ ----------
237
+
238
+ © 2025 FinBrain Technologies — Built with ❤️ for the quant community.
@@ -0,0 +1,20 @@
1
+ finbrain/__init__.py,sha256=PUa6ru37E44rB-ot32_u5iqKXaHe-Y-mUZpLLOwnYIk,333
2
+ finbrain/client.py,sha256=Y7SfXhhzXSDggY-SWTtiyt6zj-1HyD4sLEa6AS-zSug,4061
3
+ finbrain/exceptions.py,sha256=_STlzmP7Z1qDkFic3QU4QqyY07MMhMm46Tmgy7HHuck,5258
4
+ finbrain/aio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ finbrain/aio/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ finbrain/endpoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ finbrain/endpoints/analyst_ratings.py,sha256=iU9JriTj-DzlgN3PH6imxM1q31ff4DCIZdzQRh286Lo,2953
8
+ finbrain/endpoints/app_ratings.py,sha256=_AnoHoN7UnLWnMeEnIpFyhIr7zAWt28dNcFwN2W2r9c,3214
9
+ finbrain/endpoints/available.py,sha256=JYNgRh3BoWNApLRoYM2dkOks5UmwrsCSE6gfkmtm-t4,2739
10
+ finbrain/endpoints/house_trades.py,sha256=FL4jBISN7WGIZubNsBp2LNiEgVLlE9EUZ9GIZFSpbw8,2814
11
+ finbrain/endpoints/insider_transactions.py,sha256=lV3Zaz2SfuEnJvThAyxtfh-WuGjLN09WXc3oN0EcH6g,2336
12
+ finbrain/endpoints/linkedin_data.py,sha256=WfuBBGQ2yR-414R26CzfJJImlTS7k0uWN_w0wziGBa8,2973
13
+ finbrain/endpoints/options.py,sha256=dzVVvXoHbWfBo39afUg_IQ35qHTPfROf-ssKg929uLg,3446
14
+ finbrain/endpoints/predictions.py,sha256=kDxC1ubKbpapeF12qahiGrD6V68ljBXuWdiu_0jHq64,4166
15
+ finbrain/endpoints/sentiments.py,sha256=jqYSPM-_-Vge1MkU-pQ0oyJQgI_nVYf-Ocq8qiLPAlA,3569
16
+ finbrain_python-0.1.1.dist-info/licenses/LICENSE,sha256=x71LjIUPbK7Y8YBulH_AXzEIX7BK90dgFL2zA6LBT-A,1069
17
+ finbrain_python-0.1.1.dist-info/METADATA,sha256=JGCu1Nu4khVj_W826cObCqZb-EghvetalZeVilr15NY,8192
18
+ finbrain_python-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ finbrain_python-0.1.1.dist-info/top_level.txt,sha256=dCiQtTx3z2TtO_yQI6q3yODcdb-pABB-iEReJegVAv0,9
20
+ finbrain_python-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ahmetsbilgin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ finbrain