finbrain-python 0.1.1__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.
- finbrain_python-0.1.1/.gitattributes +2 -0
- finbrain_python-0.1.1/.github/workflows/ci.yml +20 -0
- finbrain_python-0.1.1/.github/workflows/release.yml +37 -0
- finbrain_python-0.1.1/.gitignore +181 -0
- finbrain_python-0.1.1/LICENSE +21 -0
- finbrain_python-0.1.1/PKG-INFO +238 -0
- finbrain_python-0.1.1/README.md +218 -0
- finbrain_python-0.1.1/cli.py +0 -0
- finbrain_python-0.1.1/models.py +0 -0
- finbrain_python-0.1.1/pyproject.toml +37 -0
- finbrain_python-0.1.1/setup.cfg +4 -0
- finbrain_python-0.1.1/src/finbrain/__init__.py +12 -0
- finbrain_python-0.1.1/src/finbrain/aio/__init__.py +0 -0
- finbrain_python-0.1.1/src/finbrain/aio/client.py +0 -0
- finbrain_python-0.1.1/src/finbrain/client.py +112 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/__init__.py +0 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/analyst_ratings.py +83 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/app_ratings.py +102 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/available.py +83 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/house_trades.py +82 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/insider_transactions.py +68 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/linkedin_data.py +85 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/options.py +86 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/predictions.py +130 -0
- finbrain_python-0.1.1/src/finbrain/endpoints/sentiments.py +108 -0
- finbrain_python-0.1.1/src/finbrain/exceptions.py +140 -0
- finbrain_python-0.1.1/src/finbrain_python.egg-info/PKG-INFO +238 -0
- finbrain_python-0.1.1/src/finbrain_python.egg-info/SOURCES.txt +41 -0
- finbrain_python-0.1.1/src/finbrain_python.egg-info/dependency_links.txt +1 -0
- finbrain_python-0.1.1/src/finbrain_python.egg-info/requires.txt +10 -0
- finbrain_python-0.1.1/src/finbrain_python.egg-info/top_level.txt +1 -0
- finbrain_python-0.1.1/tests/__init__.py +0 -0
- finbrain_python-0.1.1/tests/conftest.py +41 -0
- finbrain_python-0.1.1/tests/test_analyst_ratings.py +88 -0
- finbrain_python-0.1.1/tests/test_app_ratings.py +56 -0
- finbrain_python-0.1.1/tests/test_available.py +60 -0
- finbrain_python-0.1.1/tests/test_house_trades.py +76 -0
- finbrain_python-0.1.1/tests/test_insider_transactions.py +82 -0
- finbrain_python-0.1.1/tests/test_linkedin_data.py +61 -0
- finbrain_python-0.1.1/tests/test_options.py +76 -0
- finbrain_python-0.1.1/tests/test_predictions.py +126 -0
- finbrain_python-0.1.1/tests/test_sentiments.py +86 -0
- finbrain_python-0.1.1/utils.py +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python: ['3.9', '3.10', '3.11', '3.12']
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: ${{ matrix.python }}
|
|
18
|
+
- run: pip install -e .[dev]
|
|
19
|
+
- run: ruff check .
|
|
20
|
+
- run: pytest -q
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Build & Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['[0-9]*'] # e.g. v0.1.0, v1.2.3
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with: {python-version: '3.12'}
|
|
18
|
+
|
|
19
|
+
- name: Install build backend
|
|
20
|
+
run: python -m pip install --upgrade build twine setuptools setuptools_scm[toml]
|
|
21
|
+
|
|
22
|
+
- name: Build wheel + sdist
|
|
23
|
+
run: python -m build
|
|
24
|
+
|
|
25
|
+
# ─────────── push to TestPyPI first ───────────
|
|
26
|
+
- name: Upload to TestPyPI
|
|
27
|
+
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
|
28
|
+
env:
|
|
29
|
+
TWINE_USERNAME: __token__
|
|
30
|
+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
|
31
|
+
|
|
32
|
+
# ─────────── then to production PyPI ───────────
|
|
33
|
+
- name: Upload to PyPI
|
|
34
|
+
run: twine upload dist/*
|
|
35
|
+
env:
|
|
36
|
+
TWINE_USERNAME: __token__
|
|
37
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Ruff stuff:
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# PyPI configuration file
|
|
174
|
+
.pypirc
|
|
175
|
+
|
|
176
|
+
# Cursor
|
|
177
|
+
# Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
|
|
178
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
179
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
180
|
+
.cursorignore
|
|
181
|
+
.cursorindexingignore
|
|
@@ -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,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 <!-- omit in toc -->
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/finbrain-python/)
|
|
24
|
+
[](https://github.com/finbrain-tech/finbrain-python/actions/workflows/ci.yml)
|
|
25
|
+
[](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.
|