finance-pulse 0.1.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.
- finance_pulse-0.1.0/.gitignore +18 -0
- finance_pulse-0.1.0/LICENSE +21 -0
- finance_pulse-0.1.0/PKG-INFO +234 -0
- finance_pulse-0.1.0/README.md +202 -0
- finance_pulse-0.1.0/pyproject.toml +50 -0
- finance_pulse-0.1.0/server.json +31 -0
- finance_pulse-0.1.0/src/finance_pulse/__init__.py +5 -0
- finance_pulse-0.1.0/src/finance_pulse/client.py +327 -0
- finance_pulse-0.1.0/src/finance_pulse/mcp_server.py +270 -0
- finance_pulse-0.1.0/src/finance_pulse/py.typed +0 -0
- finance_pulse-0.1.0/tests/test_client.py +419 -0
- finance_pulse-0.1.0/tests/test_mcp_server.py +195 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FinTopic
|
|
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,234 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: finance-pulse
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client and MCP server for the Finance Pulse API: financial news as structured, sourced statements with sentiment, clustered into developments.
|
|
5
|
+
Project-URL: Homepage, https://fintopic.news/docs
|
|
6
|
+
Project-URL: Documentation, https://fintopic.news/docs/reference
|
|
7
|
+
Project-URL: Get an API key, https://rapidapi.com/evankos/api/finance-pulse/pricing
|
|
8
|
+
Project-URL: Repository, https://github.com/SlothyAfk/finance-pulse-python
|
|
9
|
+
Project-URL: Issues, https://github.com/SlothyAfk/finance-pulse-python/issues
|
|
10
|
+
Author: FinTopic
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: finance,llm,mcp,news,rag,rapidapi,sentiment,stocks
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: mcp<3,>=2
|
|
28
|
+
Requires-Dist: pydantic>=2
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Finance Pulse: Python client and MCP server
|
|
34
|
+
|
|
35
|
+
<!-- mcp-name: io.github.SlothyAfk/finance-pulse -->
|
|
36
|
+
|
|
37
|
+
Financial news as structured, sourced data. [Finance Pulse](https://fintopic.news/docs) reads financial news as it
|
|
38
|
+
is published and turns every article into **statements**: one-sentence facts with sentiment, importance, tickers,
|
|
39
|
+
sector, source and publication time. Statements about the same development are clustered into **topics**, and
|
|
40
|
+
topics into 19 **themes**. [fintopic.news](https://fintopic.news/) is a front page built on the same API.
|
|
41
|
+
|
|
42
|
+
This package gives you two ways to use it:
|
|
43
|
+
|
|
44
|
+
- a **Python client** for scripts, notebooks and pipelines;
|
|
45
|
+
- an **MCP server**, so Claude, Cursor and other MCP clients can query the news directly.
|
|
46
|
+
|
|
47
|
+
**You need a RapidAPI key that is subscribed to Finance Pulse.** Create a RapidAPI account, open the
|
|
48
|
+
[plans page](https://rapidapi.com/evankos/api/finance-pulse/pricing) and subscribe to a plan: Basic is free and is
|
|
49
|
+
enough to try everything below. Then copy your `X-RapidAPI-Key` from the API's page on RapidAPI (the endpoint playground shows it). A key that
|
|
50
|
+
is not subscribed to a plan is answered with 403.
|
|
51
|
+
|
|
52
|
+
## Use it from Claude or Cursor (MCP)
|
|
53
|
+
|
|
54
|
+
The server runs with `uvx`, which is part of [uv](https://docs.astral.sh/uv/getting-started/installation/):
|
|
55
|
+
install uv first. The package itself needs no separate install.
|
|
56
|
+
|
|
57
|
+
**Claude Code**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
claude mcp add --env RAPIDAPI_KEY=YOUR_RAPIDAPI_KEY --transport stdio finance-pulse -- uvx finance-pulse
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Claude Desktop** and **Cursor**
|
|
64
|
+
|
|
65
|
+
- Claude Desktop: Settings > Developer > Edit Config opens `claude_desktop_config.json`
|
|
66
|
+
(macOS `~/Library/Application Support/Claude/`, Windows `%APPDATA%\Claude\`). Quit and restart Claude Desktop
|
|
67
|
+
completely afterwards.
|
|
68
|
+
- Cursor: `~/.cursor/mcp.json`
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"finance-pulse": {
|
|
74
|
+
"command": "uvx",
|
|
75
|
+
"args": ["finance-pulse"],
|
|
76
|
+
"env": { "RAPIDAPI_KEY": "YOUR_RAPIDAPI_KEY" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If the server does not start in Claude Desktop, it usually cannot find `uvx`: put the full path (the output of
|
|
83
|
+
`which uvx`, or `where uvx` on Windows) in `"command"`.
|
|
84
|
+
|
|
85
|
+
`uvx` keeps the version it installed first. To move to a new release, use `finance-pulse@latest` in place of
|
|
86
|
+
`finance-pulse` once, or run `uv cache clean finance-pulse`.
|
|
87
|
+
|
|
88
|
+
Then ask things like:
|
|
89
|
+
|
|
90
|
+
- "What is the news saying about Nvidia today? Only the key facts, with sources."
|
|
91
|
+
- "Which tickers are suddenly getting more coverage than yesterday?"
|
|
92
|
+
- "What are the top developing stories in Energy, and how did the biggest one grow?"
|
|
93
|
+
- "Show me Tesla's daily news sentiment for the last two weeks."
|
|
94
|
+
|
|
95
|
+
### Tools
|
|
96
|
+
|
|
97
|
+
| Tool | What it does |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `search_statements` | Statements by symbol, sector, theme, topic, sentiment, minimum importance and time range |
|
|
100
|
+
| `trending` | The developments most outlets are reporting now, or per 2-hour slot over 7 days |
|
|
101
|
+
| `find_topics` | Developments for a symbol, sector or theme, by velocity, size or recency |
|
|
102
|
+
| `get_topic` | One development: counts, its mix of news, analysis and reddit statements, newest statements with their outlets |
|
|
103
|
+
| `sentiment_series` | Daily or hourly news volume and sentiment for a symbol, sector, theme or topic |
|
|
104
|
+
| `screen` | Symbols (optionally only equities and ETFs) or sectors ranked by news attention and its change against the previous period |
|
|
105
|
+
| `themes` | The standing subjects with their volume and sentiment, optionally only those a symbol or sector appears in |
|
|
106
|
+
| `reference` | The data window, known data incidents, theme ids and accepted filter values |
|
|
107
|
+
|
|
108
|
+
Each tool call is one API request. Results are trimmed and default to small pages, so the free plan goes a long way.
|
|
109
|
+
|
|
110
|
+
## Use it from Python
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install finance-pulse
|
|
114
|
+
export RAPIDAPI_KEY=YOUR_RAPIDAPI_KEY
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The MCP SDK is installed with the package even if you only use the client.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from datetime import datetime, timedelta, timezone
|
|
121
|
+
|
|
122
|
+
from finance_pulse import FinancePulse
|
|
123
|
+
|
|
124
|
+
fp = FinancePulse() # or FinancePulse("YOUR_RAPIDAPI_KEY")
|
|
125
|
+
|
|
126
|
+
# The newest key facts about a ticker
|
|
127
|
+
for s in fp.statements(symbol="NVDA", importance_min="high", limit=5)["data"]:
|
|
128
|
+
print(s["published_at"][:16], s["sentiment"], s["statement"], f"({s['source_domain']})")
|
|
129
|
+
|
|
130
|
+
# Which tickers are suddenly in the news (kind= leaves out rates, central banks, countries, ...)
|
|
131
|
+
for row in fp.symbols(period="d", sort="change", kind=["equity", "etf"], limit=10)["data"]:
|
|
132
|
+
print(row["id"], row["mentions"], row["change"])
|
|
133
|
+
|
|
134
|
+
# Daily news volume and sentiment, last two weeks
|
|
135
|
+
since = (datetime.now(timezone.utc) - timedelta(days=14)).strftime("%Y-%m-%dT00:00:00Z")
|
|
136
|
+
for b in fp.series(symbol="TSLA", interval="day", since=since)["data"]["buckets"]:
|
|
137
|
+
print(b["t"][:10], b["count"], b["score"])
|
|
138
|
+
|
|
139
|
+
# What most outlets are reporting right now
|
|
140
|
+
for t in fp.trending(kind="live")["data"][:10]:
|
|
141
|
+
print(t["sources"], "sources:", t["name"])
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Every method returns the API's JSON unchanged: `{"data": ..., "next_cursor": ..., "snapshot": {...}}`. The
|
|
145
|
+
`snapshot` block says how fresh the data is.
|
|
146
|
+
|
|
147
|
+
### Follow the news without missing anything
|
|
148
|
+
|
|
149
|
+
`poll_feed` yields every new statement in the order it entered the API and keeps its position in a file, so it
|
|
150
|
+
survives restarts: after a crash nothing is skipped and only the statement you were working on is delivered
|
|
151
|
+
again. The first run, with no saved position, starts 24 hours back, and the position is first stored once that
|
|
152
|
+
first page has been handled. After a long pause the poller reads the whole backlog since its saved position, one
|
|
153
|
+
request per 100 statements; delete the cursor file to start 24 hours back instead.
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
for s in fp.poll_feed(sector="Energy", importance_min="high", cursor_file="energy.cursor.json"):
|
|
157
|
+
print(s["indexed_at"], s["statement"], s["source_url"])
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The API builds new data about every 2.5 minutes, so the poller waits 150 seconds between polls by default. One
|
|
161
|
+
poller at that rate makes about 576 requests a day. Timeouts and server errors are retried; a used-up quota (429)
|
|
162
|
+
is raised.
|
|
163
|
+
|
|
164
|
+
### More than one page
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
rows = list(fp.iter_statements(symbol=["NVDA", "AMD"], importance_min="medium", max_items=1000))
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Each page of 100 is one request. Without `max_items` it stops after 500 rows; `max_items=None` reads to the end
|
|
171
|
+
of the window.
|
|
172
|
+
|
|
173
|
+
### Errors
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from finance_pulse import FinancePulseError
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
fp.statements(symbol="S&P")
|
|
180
|
+
except FinancePulseError as e:
|
|
181
|
+
print(e.status, e.title, e.detail, e.param)
|
|
182
|
+
# 400 | Invalid symbol | 'S&P' is not a ticker | symbol
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
A `429` means the plan's request quota or rate limit is used up. Timeouts and network failures are raised as
|
|
186
|
+
`FinancePulseError` too, with `status` 0; `e.transient` is true for those and for 5xx answers.
|
|
187
|
+
|
|
188
|
+
### Methods
|
|
189
|
+
|
|
190
|
+
| Method | Endpoint |
|
|
191
|
+
|---|---|
|
|
192
|
+
| `statements`, `iter_statements`, `statement` | `/v2/statements`, `/v2/statements/{id}` |
|
|
193
|
+
| `feed`, `poll_feed` | `/v2/feed` |
|
|
194
|
+
| `series` | `/v2/series` |
|
|
195
|
+
| `symbols`, `sectors` | `/v2/symbols`, `/v2/sectors` |
|
|
196
|
+
| `trending` | `/v2/trending` |
|
|
197
|
+
| `topics`, `topic` | `/v2/topics`, `/v2/topics/{id}` |
|
|
198
|
+
| `themes`, `theme` | `/v2/themes`, `/v2/themes/{id}` |
|
|
199
|
+
| `meta` | `/v2/meta` |
|
|
200
|
+
|
|
201
|
+
The package targets Finance Pulse API 2.0 (the `/v2` endpoints). Parameters and response fields are documented in
|
|
202
|
+
the [API reference](https://fintopic.news/docs/reference), and the
|
|
203
|
+
[guides](https://fintopic.news/docs) show complete worked examples.
|
|
204
|
+
|
|
205
|
+
## What the data is, and is not
|
|
206
|
+
|
|
207
|
+
- **Symbols are codes extracted by a language model**, not exchange tickers. Most equities match their ticker;
|
|
208
|
+
macro entities are codes too (`FED`, `ECB`, `CRUDE`, `US10Y`). Map the codes you trade before relying on them.
|
|
209
|
+
- **Sentiment describes the statement**, not a price forecast. A symbol's sentiment is the count of its
|
|
210
|
+
statements' labels.
|
|
211
|
+
- **The window is a rolling 62 days.** `meta()` lists known outages and delays under `incidents`.
|
|
212
|
+
|
|
213
|
+
See [the docs](https://fintopic.news/docs) for the full list of caveats.
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
pip install -e ".[dev]"
|
|
219
|
+
pytest
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
The tests use canned responses and make no API requests.
|
|
223
|
+
|
|
224
|
+
### Releasing
|
|
225
|
+
|
|
226
|
+
1. Set the new version in `src/finance_pulse/__init__.py` and in `server.json` (two places).
|
|
227
|
+
2. Build and upload to PyPI (`uv build && uv publish`). From GitHub Actions, use `pypa/gh-action-pypi-publish`
|
|
228
|
+
v1.14.2 or newer: older versions reject the metadata version this build writes.
|
|
229
|
+
3. Only then run `mcp-publisher publish`: the registry verifies the package on PyPI (it looks for the
|
|
230
|
+
`mcp-name` line in its description), so the release must be there first.
|
|
231
|
+
|
|
232
|
+
## Licence
|
|
233
|
+
|
|
234
|
+
MIT
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Finance Pulse: Python client and MCP server
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.SlothyAfk/finance-pulse -->
|
|
4
|
+
|
|
5
|
+
Financial news as structured, sourced data. [Finance Pulse](https://fintopic.news/docs) reads financial news as it
|
|
6
|
+
is published and turns every article into **statements**: one-sentence facts with sentiment, importance, tickers,
|
|
7
|
+
sector, source and publication time. Statements about the same development are clustered into **topics**, and
|
|
8
|
+
topics into 19 **themes**. [fintopic.news](https://fintopic.news/) is a front page built on the same API.
|
|
9
|
+
|
|
10
|
+
This package gives you two ways to use it:
|
|
11
|
+
|
|
12
|
+
- a **Python client** for scripts, notebooks and pipelines;
|
|
13
|
+
- an **MCP server**, so Claude, Cursor and other MCP clients can query the news directly.
|
|
14
|
+
|
|
15
|
+
**You need a RapidAPI key that is subscribed to Finance Pulse.** Create a RapidAPI account, open the
|
|
16
|
+
[plans page](https://rapidapi.com/evankos/api/finance-pulse/pricing) and subscribe to a plan: Basic is free and is
|
|
17
|
+
enough to try everything below. Then copy your `X-RapidAPI-Key` from the API's page on RapidAPI (the endpoint playground shows it). A key that
|
|
18
|
+
is not subscribed to a plan is answered with 403.
|
|
19
|
+
|
|
20
|
+
## Use it from Claude or Cursor (MCP)
|
|
21
|
+
|
|
22
|
+
The server runs with `uvx`, which is part of [uv](https://docs.astral.sh/uv/getting-started/installation/):
|
|
23
|
+
install uv first. The package itself needs no separate install.
|
|
24
|
+
|
|
25
|
+
**Claude Code**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
claude mcp add --env RAPIDAPI_KEY=YOUR_RAPIDAPI_KEY --transport stdio finance-pulse -- uvx finance-pulse
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Claude Desktop** and **Cursor**
|
|
32
|
+
|
|
33
|
+
- Claude Desktop: Settings > Developer > Edit Config opens `claude_desktop_config.json`
|
|
34
|
+
(macOS `~/Library/Application Support/Claude/`, Windows `%APPDATA%\Claude\`). Quit and restart Claude Desktop
|
|
35
|
+
completely afterwards.
|
|
36
|
+
- Cursor: `~/.cursor/mcp.json`
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"finance-pulse": {
|
|
42
|
+
"command": "uvx",
|
|
43
|
+
"args": ["finance-pulse"],
|
|
44
|
+
"env": { "RAPIDAPI_KEY": "YOUR_RAPIDAPI_KEY" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If the server does not start in Claude Desktop, it usually cannot find `uvx`: put the full path (the output of
|
|
51
|
+
`which uvx`, or `where uvx` on Windows) in `"command"`.
|
|
52
|
+
|
|
53
|
+
`uvx` keeps the version it installed first. To move to a new release, use `finance-pulse@latest` in place of
|
|
54
|
+
`finance-pulse` once, or run `uv cache clean finance-pulse`.
|
|
55
|
+
|
|
56
|
+
Then ask things like:
|
|
57
|
+
|
|
58
|
+
- "What is the news saying about Nvidia today? Only the key facts, with sources."
|
|
59
|
+
- "Which tickers are suddenly getting more coverage than yesterday?"
|
|
60
|
+
- "What are the top developing stories in Energy, and how did the biggest one grow?"
|
|
61
|
+
- "Show me Tesla's daily news sentiment for the last two weeks."
|
|
62
|
+
|
|
63
|
+
### Tools
|
|
64
|
+
|
|
65
|
+
| Tool | What it does |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `search_statements` | Statements by symbol, sector, theme, topic, sentiment, minimum importance and time range |
|
|
68
|
+
| `trending` | The developments most outlets are reporting now, or per 2-hour slot over 7 days |
|
|
69
|
+
| `find_topics` | Developments for a symbol, sector or theme, by velocity, size or recency |
|
|
70
|
+
| `get_topic` | One development: counts, its mix of news, analysis and reddit statements, newest statements with their outlets |
|
|
71
|
+
| `sentiment_series` | Daily or hourly news volume and sentiment for a symbol, sector, theme or topic |
|
|
72
|
+
| `screen` | Symbols (optionally only equities and ETFs) or sectors ranked by news attention and its change against the previous period |
|
|
73
|
+
| `themes` | The standing subjects with their volume and sentiment, optionally only those a symbol or sector appears in |
|
|
74
|
+
| `reference` | The data window, known data incidents, theme ids and accepted filter values |
|
|
75
|
+
|
|
76
|
+
Each tool call is one API request. Results are trimmed and default to small pages, so the free plan goes a long way.
|
|
77
|
+
|
|
78
|
+
## Use it from Python
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install finance-pulse
|
|
82
|
+
export RAPIDAPI_KEY=YOUR_RAPIDAPI_KEY
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The MCP SDK is installed with the package even if you only use the client.
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from datetime import datetime, timedelta, timezone
|
|
89
|
+
|
|
90
|
+
from finance_pulse import FinancePulse
|
|
91
|
+
|
|
92
|
+
fp = FinancePulse() # or FinancePulse("YOUR_RAPIDAPI_KEY")
|
|
93
|
+
|
|
94
|
+
# The newest key facts about a ticker
|
|
95
|
+
for s in fp.statements(symbol="NVDA", importance_min="high", limit=5)["data"]:
|
|
96
|
+
print(s["published_at"][:16], s["sentiment"], s["statement"], f"({s['source_domain']})")
|
|
97
|
+
|
|
98
|
+
# Which tickers are suddenly in the news (kind= leaves out rates, central banks, countries, ...)
|
|
99
|
+
for row in fp.symbols(period="d", sort="change", kind=["equity", "etf"], limit=10)["data"]:
|
|
100
|
+
print(row["id"], row["mentions"], row["change"])
|
|
101
|
+
|
|
102
|
+
# Daily news volume and sentiment, last two weeks
|
|
103
|
+
since = (datetime.now(timezone.utc) - timedelta(days=14)).strftime("%Y-%m-%dT00:00:00Z")
|
|
104
|
+
for b in fp.series(symbol="TSLA", interval="day", since=since)["data"]["buckets"]:
|
|
105
|
+
print(b["t"][:10], b["count"], b["score"])
|
|
106
|
+
|
|
107
|
+
# What most outlets are reporting right now
|
|
108
|
+
for t in fp.trending(kind="live")["data"][:10]:
|
|
109
|
+
print(t["sources"], "sources:", t["name"])
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Every method returns the API's JSON unchanged: `{"data": ..., "next_cursor": ..., "snapshot": {...}}`. The
|
|
113
|
+
`snapshot` block says how fresh the data is.
|
|
114
|
+
|
|
115
|
+
### Follow the news without missing anything
|
|
116
|
+
|
|
117
|
+
`poll_feed` yields every new statement in the order it entered the API and keeps its position in a file, so it
|
|
118
|
+
survives restarts: after a crash nothing is skipped and only the statement you were working on is delivered
|
|
119
|
+
again. The first run, with no saved position, starts 24 hours back, and the position is first stored once that
|
|
120
|
+
first page has been handled. After a long pause the poller reads the whole backlog since its saved position, one
|
|
121
|
+
request per 100 statements; delete the cursor file to start 24 hours back instead.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
for s in fp.poll_feed(sector="Energy", importance_min="high", cursor_file="energy.cursor.json"):
|
|
125
|
+
print(s["indexed_at"], s["statement"], s["source_url"])
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The API builds new data about every 2.5 minutes, so the poller waits 150 seconds between polls by default. One
|
|
129
|
+
poller at that rate makes about 576 requests a day. Timeouts and server errors are retried; a used-up quota (429)
|
|
130
|
+
is raised.
|
|
131
|
+
|
|
132
|
+
### More than one page
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
rows = list(fp.iter_statements(symbol=["NVDA", "AMD"], importance_min="medium", max_items=1000))
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Each page of 100 is one request. Without `max_items` it stops after 500 rows; `max_items=None` reads to the end
|
|
139
|
+
of the window.
|
|
140
|
+
|
|
141
|
+
### Errors
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from finance_pulse import FinancePulseError
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
fp.statements(symbol="S&P")
|
|
148
|
+
except FinancePulseError as e:
|
|
149
|
+
print(e.status, e.title, e.detail, e.param)
|
|
150
|
+
# 400 | Invalid symbol | 'S&P' is not a ticker | symbol
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
A `429` means the plan's request quota or rate limit is used up. Timeouts and network failures are raised as
|
|
154
|
+
`FinancePulseError` too, with `status` 0; `e.transient` is true for those and for 5xx answers.
|
|
155
|
+
|
|
156
|
+
### Methods
|
|
157
|
+
|
|
158
|
+
| Method | Endpoint |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `statements`, `iter_statements`, `statement` | `/v2/statements`, `/v2/statements/{id}` |
|
|
161
|
+
| `feed`, `poll_feed` | `/v2/feed` |
|
|
162
|
+
| `series` | `/v2/series` |
|
|
163
|
+
| `symbols`, `sectors` | `/v2/symbols`, `/v2/sectors` |
|
|
164
|
+
| `trending` | `/v2/trending` |
|
|
165
|
+
| `topics`, `topic` | `/v2/topics`, `/v2/topics/{id}` |
|
|
166
|
+
| `themes`, `theme` | `/v2/themes`, `/v2/themes/{id}` |
|
|
167
|
+
| `meta` | `/v2/meta` |
|
|
168
|
+
|
|
169
|
+
The package targets Finance Pulse API 2.0 (the `/v2` endpoints). Parameters and response fields are documented in
|
|
170
|
+
the [API reference](https://fintopic.news/docs/reference), and the
|
|
171
|
+
[guides](https://fintopic.news/docs) show complete worked examples.
|
|
172
|
+
|
|
173
|
+
## What the data is, and is not
|
|
174
|
+
|
|
175
|
+
- **Symbols are codes extracted by a language model**, not exchange tickers. Most equities match their ticker;
|
|
176
|
+
macro entities are codes too (`FED`, `ECB`, `CRUDE`, `US10Y`). Map the codes you trade before relying on them.
|
|
177
|
+
- **Sentiment describes the statement**, not a price forecast. A symbol's sentiment is the count of its
|
|
178
|
+
statements' labels.
|
|
179
|
+
- **The window is a rolling 62 days.** `meta()` lists known outages and delays under `incidents`.
|
|
180
|
+
|
|
181
|
+
See [the docs](https://fintopic.news/docs) for the full list of caveats.
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pip install -e ".[dev]"
|
|
187
|
+
pytest
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The tests use canned responses and make no API requests.
|
|
191
|
+
|
|
192
|
+
### Releasing
|
|
193
|
+
|
|
194
|
+
1. Set the new version in `src/finance_pulse/__init__.py` and in `server.json` (two places).
|
|
195
|
+
2. Build and upload to PyPI (`uv build && uv publish`). From GitHub Actions, use `pypa/gh-action-pypi-publish`
|
|
196
|
+
v1.14.2 or newer: older versions reject the metadata version this build writes.
|
|
197
|
+
3. Only then run `mcp-publisher publish`: the registry verifies the package on PyPI (it looks for the
|
|
198
|
+
`mcp-name` line in its description), so the release must be there first.
|
|
199
|
+
|
|
200
|
+
## Licence
|
|
201
|
+
|
|
202
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "finance-pulse"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python client and MCP server for the Finance Pulse API: financial news as structured, sourced statements with sentiment, clustered into developments."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "FinTopic" }]
|
|
13
|
+
keywords = ["finance", "news", "sentiment", "stocks", "mcp", "llm", "rag", "rapidapi"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
"Topic :: Office/Business :: Financial",
|
|
26
|
+
]
|
|
27
|
+
dependencies = ["httpx>=0.27", "mcp>=2,<3", "pydantic>=2"]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = ["pytest>=8"]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
finance-pulse = "finance_pulse.mcp_server:main" # so `uvx finance-pulse` starts the MCP server
|
|
34
|
+
finance-pulse-mcp = "finance_pulse.mcp_server:main"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://fintopic.news/docs"
|
|
38
|
+
Documentation = "https://fintopic.news/docs/reference"
|
|
39
|
+
"Get an API key" = "https://rapidapi.com/evankos/api/finance-pulse/pricing"
|
|
40
|
+
Repository = "https://github.com/SlothyAfk/finance-pulse-python"
|
|
41
|
+
Issues = "https://github.com/SlothyAfk/finance-pulse-python/issues"
|
|
42
|
+
|
|
43
|
+
[tool.hatch.version]
|
|
44
|
+
path = "src/finance_pulse/__init__.py"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/finance_pulse"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.SlothyAfk/finance-pulse",
|
|
4
|
+
"title": "Finance Pulse",
|
|
5
|
+
"description": "Financial news as sourced statements with sentiment and tickers, clustered into developments.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://fintopic.news/docs",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/SlothyAfk/finance-pulse-python",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"packages": [
|
|
13
|
+
{
|
|
14
|
+
"registryType": "pypi",
|
|
15
|
+
"identifier": "finance-pulse",
|
|
16
|
+
"version": "0.1.0",
|
|
17
|
+
"runtimeHint": "uvx",
|
|
18
|
+
"transport": {
|
|
19
|
+
"type": "stdio"
|
|
20
|
+
},
|
|
21
|
+
"environmentVariables": [
|
|
22
|
+
{
|
|
23
|
+
"name": "RAPIDAPI_KEY",
|
|
24
|
+
"description": "Your RapidAPI key, subscribed to Finance Pulse (free plan available): https://rapidapi.com/evankos/api/finance-pulse/pricing",
|
|
25
|
+
"isRequired": true,
|
|
26
|
+
"isSecret": true
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|