sentimove 1.0.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.
@@ -0,0 +1,163 @@
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
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+ db.sqlite3
60
+ db.sqlite3-journal
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ .pybuilder/
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # IPython
80
+ profile_default/
81
+ ipython_config.py
82
+
83
+ # pyenv
84
+ .python-version
85
+
86
+ # pipenv
87
+ Pipfile.lock
88
+
89
+ # poetry
90
+ poetry.lock
91
+
92
+ # pdm
93
+ .pdm.toml
94
+
95
+ # PEP 582
96
+ __pypackages__/
97
+
98
+ # Celery stuff
99
+ celerybeat-schedule
100
+ celerybeat.pid
101
+
102
+ # SageMath parsed files
103
+ *.sage.py
104
+
105
+ # Environments
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ # pytype static type analyzer
133
+ .pytype/
134
+
135
+ # Cython debug symbols
136
+ cython_debug/
137
+
138
+ # PyCharm
139
+ .idea/
140
+
141
+ # VS Code
142
+ .vscode/
143
+
144
+ # macOS
145
+ .DS_Store
146
+
147
+ # Windows
148
+ Thumbs.db
149
+ ehthumbs.db
150
+
151
+ # Fundis specific - local data (DO NOT COMMIT)
152
+ .fundis/
153
+ ~/.fundis/
154
+
155
+ # Test files
156
+ test_*.py
157
+ !tests/test_*.py
158
+
159
+ # Temporary files
160
+ *.tmp
161
+ *.bak
162
+ *.swp
163
+ *~
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yototec Ltd
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,155 @@
1
+ Metadata-Version: 2.5
2
+ Name: sentimove
3
+ Version: 1.0.0
4
+ Summary: Python client for SentiMove intelligence data - events, signals, and patterns from SentiChain.
5
+ Project-URL: Homepage, https://sentimove.com
6
+ Project-URL: Repository, https://github.com/Yototec/sentimove-sdk
7
+ Project-URL: Bug Tracker, https://github.com/Yototec/sentimove-sdk/issues
8
+ Author-email: Edward Chen <rchen@yototec.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: crypto,events,intelligence,patterns,sentichain,sentiment,sentimove,signals
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: requests<3.0.0,>=2.32.0
23
+ Description-Content-Type: text/markdown
24
+
25
+ # SentiMove
26
+
27
+ Python client for SentiMove intelligence data: events, signals, and patterns from [SentiChain](https://sentichain.com).
28
+
29
+ SentiMove Intelligence is the engine behind [SentiMove](https://sentimove.com). This package provides programmatic access to the same structured output that powers both the SentiMove live map view and its terminal mode.
30
+
31
+ This package was previously published as [`fundis`](https://pypi.org/project/fundis/). `FundisClient` and `FundisError` remain available as aliases, so switching is a one-line import change.
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install sentimove
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ```python
42
+ from sentimove import SentiMoveClient
43
+
44
+ client = SentiMoveClient()
45
+
46
+ # Get classified events for an asset
47
+ events = client.get_events("BTC")
48
+ for event in events:
49
+ print(f"[{event.type}] {event.sentiment}: {event.summary}")
50
+
51
+ # Get a directional signal with rationale
52
+ signal = client.get_signal("BTC")
53
+ if signal:
54
+ print(f"Direction: {signal.direction}, Confidence: {signal.confidence}")
55
+ print(f"Rationale: {signal.rationale}")
56
+ for cat, summary in signal.categories.items():
57
+ if summary:
58
+ print(f" {cat}: {summary}")
59
+
60
+ # List active tickers (fetched from the live API)
61
+ tickers = client.list_tickers()
62
+ print(tickers)
63
+
64
+ # Request a new ticker (requires API key)
65
+ client_with_key = SentiMoveClient(api_key="your-sentichain-api-key")
66
+ client_with_key.request_ticker("ADA")
67
+ ```
68
+
69
+ Migrating from `fundis`: replace `from fundis import FundisClient` with `from sentimove import FundisClient` (or use `SentiMoveClient`). Methods, arguments and return types are unchanged.
70
+
71
+ ## API Reference
72
+
73
+ ### `SentiMoveClient(api_key="", base_url="https://api.sentimove.com", timeout=30.0)`
74
+
75
+ Create a client instance. Intelligence data is publicly available. An API key is only needed for ticker requests and billing-related operations on SentiChain.
76
+
77
+ ### `client.get_events(ticker) -> list[Event]`
78
+
79
+ Fetch the latest classified events for a ticker. Each event contains:
80
+
81
+ | Field | Type | Description |
82
+ |-------|------|-------------|
83
+ | `timestamp` | `str` | ISO 8601 timestamp |
84
+ | `type` | `str` | Event category: `macro`, `industry`, `price`, or `asset` |
85
+ | `sentiment` | `str` | `bullish`, `bearish`, or `neutral` |
86
+ | `summary` | `str` | One-sentence event description |
87
+
88
+ ### `client.get_signal(ticker) -> Signal | None`
89
+
90
+ Fetch the latest directional signal for a ticker. Returns None if no signal data exists. Otherwise returns:
91
+
92
+ | Field | Type | Description |
93
+ |-------|------|-------------|
94
+ | `direction` | `str` | `LONG`, `SHORT`, or `FLAT` |
95
+ | `confidence` | `float` | 0.0 to 1.0 |
96
+ | `rationale` | `str` | 1-2 sentence explanation of the call |
97
+ | `categories` | `dict` | One-sentence summaries for `macro`, `industry`, `price`, `asset` |
98
+ | `patterns` | `list[Pattern]` | Detected event patterns with keywords and descriptions |
99
+
100
+ The SDK preserves the backend signal enum values (`LONG`, `SHORT`, `FLAT`). The SentiMove frontend maps those values to the softer UI wording `Bullish`, `Bearish`, and `Neutral`.
101
+
102
+ ### `client.list_tickers() -> list[str]`
103
+
104
+ Return the list of active ticker symbols from the live API.
105
+
106
+ ### `client.request_ticker(ticker) -> bool`
107
+
108
+ Request a new ticker to be added to the pipeline. Requires an API key. Returns True if the request was submitted (pending admin approval), False if the ticker already exists.
109
+
110
+ This endpoint is still available at the SDK/API layer even though the current SentiMove web UI does not expose a public request-ticker form.
111
+
112
+ ## Requirements
113
+
114
+ - Python 3.10+
115
+
116
+ ## Release
117
+
118
+ `sentimove` is distributed as a client package rather than a long-running service.
119
+
120
+ | Item | Value |
121
+ |------|-------|
122
+ | Distribution | PyPI package (`sentimove`) |
123
+ | Source Repo | `https://github.com/Yototec/sentimove-sdk` |
124
+ | Primary Runtime Target | `https://api.sentimove.com` (`https://api.fundis.ai` is an alias) |
125
+ | Registration / billing dependency | `https://api.sentichain.com` |
126
+ | Server deploy required | No |
127
+
128
+ Release verification is package-oriented:
129
+
130
+ 1. Install the package in a clean Python environment
131
+ 2. Call `get_events()`, `get_signal()`, and `list_tickers()` against the live API
132
+ 3. Publish a new PyPI release only after those calls succeed
133
+
134
+ The legacy `fundis` package is maintained on the `fundis-1.x` branch.
135
+
136
+ ## SentiMove Integration Notes
137
+
138
+ SentiMove combines two runtime data surfaces:
139
+
140
+ - live asset-header USD prices come client-side from Hyperliquid
141
+ - structured market intelligence comes from SentiMove Intelligence via `api.sentimove.com`
142
+ - both the SentiMove 3D map and terminal mode consume the same intelligence surface
143
+
144
+ This SDK only exposes the intelligence surface. It is not the source of the public live price header shown on `sentimove.com`.
145
+
146
+ ## Links
147
+
148
+ - [SentiMove](https://sentimove.com) - 3D consumer product
149
+ - [SentiChain](https://sentichain.com) - Blockchain platform and API keys
150
+ - [GitHub](https://github.com/Yototec/sentimove-sdk) - Source code
151
+ - [PyPI](https://pypi.org/project/sentimove/) - Package registry
152
+
153
+ ## License
154
+
155
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,131 @@
1
+ # SentiMove
2
+
3
+ Python client for SentiMove intelligence data: events, signals, and patterns from [SentiChain](https://sentichain.com).
4
+
5
+ SentiMove Intelligence is the engine behind [SentiMove](https://sentimove.com). This package provides programmatic access to the same structured output that powers both the SentiMove live map view and its terminal mode.
6
+
7
+ This package was previously published as [`fundis`](https://pypi.org/project/fundis/). `FundisClient` and `FundisError` remain available as aliases, so switching is a one-line import change.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install sentimove
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from sentimove import SentiMoveClient
19
+
20
+ client = SentiMoveClient()
21
+
22
+ # Get classified events for an asset
23
+ events = client.get_events("BTC")
24
+ for event in events:
25
+ print(f"[{event.type}] {event.sentiment}: {event.summary}")
26
+
27
+ # Get a directional signal with rationale
28
+ signal = client.get_signal("BTC")
29
+ if signal:
30
+ print(f"Direction: {signal.direction}, Confidence: {signal.confidence}")
31
+ print(f"Rationale: {signal.rationale}")
32
+ for cat, summary in signal.categories.items():
33
+ if summary:
34
+ print(f" {cat}: {summary}")
35
+
36
+ # List active tickers (fetched from the live API)
37
+ tickers = client.list_tickers()
38
+ print(tickers)
39
+
40
+ # Request a new ticker (requires API key)
41
+ client_with_key = SentiMoveClient(api_key="your-sentichain-api-key")
42
+ client_with_key.request_ticker("ADA")
43
+ ```
44
+
45
+ Migrating from `fundis`: replace `from fundis import FundisClient` with `from sentimove import FundisClient` (or use `SentiMoveClient`). Methods, arguments and return types are unchanged.
46
+
47
+ ## API Reference
48
+
49
+ ### `SentiMoveClient(api_key="", base_url="https://api.sentimove.com", timeout=30.0)`
50
+
51
+ Create a client instance. Intelligence data is publicly available. An API key is only needed for ticker requests and billing-related operations on SentiChain.
52
+
53
+ ### `client.get_events(ticker) -> list[Event]`
54
+
55
+ Fetch the latest classified events for a ticker. Each event contains:
56
+
57
+ | Field | Type | Description |
58
+ |-------|------|-------------|
59
+ | `timestamp` | `str` | ISO 8601 timestamp |
60
+ | `type` | `str` | Event category: `macro`, `industry`, `price`, or `asset` |
61
+ | `sentiment` | `str` | `bullish`, `bearish`, or `neutral` |
62
+ | `summary` | `str` | One-sentence event description |
63
+
64
+ ### `client.get_signal(ticker) -> Signal | None`
65
+
66
+ Fetch the latest directional signal for a ticker. Returns None if no signal data exists. Otherwise returns:
67
+
68
+ | Field | Type | Description |
69
+ |-------|------|-------------|
70
+ | `direction` | `str` | `LONG`, `SHORT`, or `FLAT` |
71
+ | `confidence` | `float` | 0.0 to 1.0 |
72
+ | `rationale` | `str` | 1-2 sentence explanation of the call |
73
+ | `categories` | `dict` | One-sentence summaries for `macro`, `industry`, `price`, `asset` |
74
+ | `patterns` | `list[Pattern]` | Detected event patterns with keywords and descriptions |
75
+
76
+ The SDK preserves the backend signal enum values (`LONG`, `SHORT`, `FLAT`). The SentiMove frontend maps those values to the softer UI wording `Bullish`, `Bearish`, and `Neutral`.
77
+
78
+ ### `client.list_tickers() -> list[str]`
79
+
80
+ Return the list of active ticker symbols from the live API.
81
+
82
+ ### `client.request_ticker(ticker) -> bool`
83
+
84
+ Request a new ticker to be added to the pipeline. Requires an API key. Returns True if the request was submitted (pending admin approval), False if the ticker already exists.
85
+
86
+ This endpoint is still available at the SDK/API layer even though the current SentiMove web UI does not expose a public request-ticker form.
87
+
88
+ ## Requirements
89
+
90
+ - Python 3.10+
91
+
92
+ ## Release
93
+
94
+ `sentimove` is distributed as a client package rather than a long-running service.
95
+
96
+ | Item | Value |
97
+ |------|-------|
98
+ | Distribution | PyPI package (`sentimove`) |
99
+ | Source Repo | `https://github.com/Yototec/sentimove-sdk` |
100
+ | Primary Runtime Target | `https://api.sentimove.com` (`https://api.fundis.ai` is an alias) |
101
+ | Registration / billing dependency | `https://api.sentichain.com` |
102
+ | Server deploy required | No |
103
+
104
+ Release verification is package-oriented:
105
+
106
+ 1. Install the package in a clean Python environment
107
+ 2. Call `get_events()`, `get_signal()`, and `list_tickers()` against the live API
108
+ 3. Publish a new PyPI release only after those calls succeed
109
+
110
+ The legacy `fundis` package is maintained on the `fundis-1.x` branch.
111
+
112
+ ## SentiMove Integration Notes
113
+
114
+ SentiMove combines two runtime data surfaces:
115
+
116
+ - live asset-header USD prices come client-side from Hyperliquid
117
+ - structured market intelligence comes from SentiMove Intelligence via `api.sentimove.com`
118
+ - both the SentiMove 3D map and terminal mode consume the same intelligence surface
119
+
120
+ This SDK only exposes the intelligence surface. It is not the source of the public live price header shown on `sentimove.com`.
121
+
122
+ ## Links
123
+
124
+ - [SentiMove](https://sentimove.com) - 3D consumer product
125
+ - [SentiChain](https://sentichain.com) - Blockchain platform and API keys
126
+ - [GitHub](https://github.com/Yototec/sentimove-sdk) - Source code
127
+ - [PyPI](https://pypi.org/project/sentimove/) - Package registry
128
+
129
+ ## License
130
+
131
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "sentimove"
7
+ version = "1.0.0"
8
+ description = "Python client for SentiMove intelligence data - events, signals, and patterns from SentiChain."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ { name = "Edward Chen", email = "rchen@yototec.com" },
13
+ ]
14
+ license = { text = "MIT" }
15
+ dependencies = [
16
+ "requests>=2.32.0,<3.0.0",
17
+ ]
18
+ keywords = [
19
+ "sentimove",
20
+ "sentichain",
21
+ "intelligence",
22
+ "sentiment",
23
+ "crypto",
24
+ "events",
25
+ "signals",
26
+ "patterns",
27
+ ]
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Intended Audience :: Developers",
31
+ "License :: OSI Approved :: MIT License",
32
+ "Programming Language :: Python :: 3",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://sentimove.com"
42
+ Repository = "https://github.com/Yototec/sentimove-sdk"
43
+ "Bug Tracker" = "https://github.com/Yototec/sentimove-sdk/issues"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["sentimove"]
@@ -0,0 +1,23 @@
1
+ """SentiMove - Python client for SentiChain intelligence data."""
2
+
3
+ from sentimove.client import SentiMoveClient
4
+ from sentimove.exceptions import APIError, AuthenticationError, FundisError, SentiMoveError
5
+ from sentimove.types import Event, Pattern, Signal
6
+
7
+ __version__ = "1.0.0"
8
+
9
+ # Name used by the former fundis package; behaves exactly like SentiMoveClient.
10
+ FundisClient = SentiMoveClient
11
+
12
+ __all__ = [
13
+ "SentiMoveClient",
14
+ "FundisClient",
15
+ "Event",
16
+ "Signal",
17
+ "Pattern",
18
+ "SentiMoveError",
19
+ "FundisError",
20
+ "AuthenticationError",
21
+ "APIError",
22
+ "__version__",
23
+ ]
@@ -0,0 +1,189 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from typing import Any, Optional
5
+
6
+ import requests
7
+
8
+ from sentimove.exceptions import APIError, SentiMoveError
9
+ from sentimove.types import Event, Pattern, Signal
10
+
11
+
12
+ class SentiMoveClient:
13
+ """Thin client for querying SentiMove intelligence data via the API.
14
+
15
+ Parameters
16
+ ----------
17
+ api_key:
18
+ A valid SentiChain API key (used for ticker requests and billing).
19
+ base_url:
20
+ Root URL for the SentiMove intelligence API.
21
+ timeout:
22
+ HTTP request timeout in seconds.
23
+ """
24
+
25
+ def __init__(
26
+ self,
27
+ api_key: str = "",
28
+ base_url: str = "https://api.sentimove.com",
29
+ timeout: float = 30.0,
30
+ ) -> None:
31
+ self._api_key = api_key
32
+ self._base_url = base_url.rstrip("/")
33
+ self._timeout = timeout
34
+ self._session = requests.Session()
35
+
36
+ def get_events(self, ticker: str) -> list[Event]:
37
+ """Fetch the latest classified events for *ticker*.
38
+
39
+ Returns a list of :class:`Event` objects parsed from the most recent
40
+ pipeline chunk.
41
+ """
42
+ ticker = ticker.upper().strip()
43
+ if not ticker:
44
+ raise SentiMoveError("ticker must be a non-empty string.")
45
+
46
+ raw = self._fetch_reasoning(ticker=ticker, summary_type="sm_events")
47
+
48
+ if raw is None:
49
+ return []
50
+
51
+ items = self._parse_json(raw)
52
+ if not isinstance(items, list):
53
+ return []
54
+
55
+ events: list[Event] = []
56
+ for item in items:
57
+ events.append(
58
+ Event(
59
+ timestamp=str(item.get("timestamp", "")),
60
+ type=str(item.get("event", "asset")).lower(),
61
+ sentiment=str(item.get("sentiment", "neutral")).lower(),
62
+ summary=str(item.get("summary", "")),
63
+ )
64
+ )
65
+ return events
66
+
67
+ def get_signal(self, ticker: str) -> Optional[Signal]:
68
+ """Fetch the latest directional signal for *ticker*.
69
+
70
+ Returns a :class:`Signal` object with direction, confidence,
71
+ rationale, category summaries, and detected patterns.
72
+ Returns None if no signal data exists for this ticker.
73
+ """
74
+ ticker = ticker.upper().strip()
75
+ if not ticker:
76
+ raise SentiMoveError("ticker must be a non-empty string.")
77
+
78
+ raw = self._fetch_reasoning(ticker=ticker, summary_type="sm_signal")
79
+
80
+ if raw is None:
81
+ return None
82
+
83
+ data = self._parse_json(raw)
84
+ if not isinstance(data, dict):
85
+ raise APIError("Signal data is not a JSON object.")
86
+
87
+ patterns: list[Pattern] = []
88
+ for p in data.get("patterns", []):
89
+ if isinstance(p, dict):
90
+ patterns.append(
91
+ Pattern(
92
+ keywords=p.get("keywords", []),
93
+ event_indices=p.get("event_indices", []),
94
+ description=p.get("description", ""),
95
+ )
96
+ )
97
+
98
+ return Signal(
99
+ direction=str(data.get("direction", "FLAT")),
100
+ confidence=float(data.get("confidence", 0.0)),
101
+ rationale=str(data.get("rationale", "")),
102
+ categories=data.get("categories", {}),
103
+ patterns=patterns,
104
+ )
105
+
106
+ def list_tickers(self) -> list[str]:
107
+ """Return the list of active ticker symbols from the API."""
108
+ url = f"{self._base_url}/agent/tickers"
109
+ try:
110
+ resp = self._session.get(url, timeout=self._timeout)
111
+ except requests.RequestException as exc:
112
+ raise APIError(f"Request failed: {exc}") from exc
113
+
114
+ if resp.status_code != 200:
115
+ raise APIError(
116
+ f"Unexpected response from API (HTTP {resp.status_code}).",
117
+ status_code=resp.status_code,
118
+ )
119
+
120
+ data: dict[str, Any] = resp.json()
121
+ tickers = data.get("tickers", [])
122
+ if not isinstance(tickers, list):
123
+ raise APIError("Tickers response is not a list.")
124
+ return tickers
125
+
126
+ def request_ticker(self, ticker: str) -> bool:
127
+ """Request a new ticker to be added to the pipeline.
128
+
129
+ Requires an API key set on the client. Returns True if the request
130
+ was submitted, False if the ticker already exists.
131
+ """
132
+ ticker = ticker.upper().strip()
133
+ if not ticker:
134
+ raise SentiMoveError("ticker must be a non-empty string.")
135
+ if not self._api_key:
136
+ raise SentiMoveError("api_key is required to request a ticker.")
137
+
138
+ url = f"{self._base_url}/agent/tickers/request"
139
+ try:
140
+ resp = self._session.post(
141
+ url,
142
+ json={"ticker": ticker, "api_key": self._api_key},
143
+ timeout=self._timeout,
144
+ )
145
+ except requests.RequestException as exc:
146
+ raise APIError(f"Request failed: {exc}") from exc
147
+
148
+ if resp.status_code != 200:
149
+ raise APIError(
150
+ f"Unexpected response from API (HTTP {resp.status_code}).",
151
+ status_code=resp.status_code,
152
+ )
153
+
154
+ data: dict[str, Any] = resp.json()
155
+ return data.get("status") == "pending"
156
+
157
+ # ------------------------------------------------------------------
158
+ # Internal helpers
159
+ # ------------------------------------------------------------------
160
+
161
+ def _fetch_reasoning(self, ticker: str, summary_type: str) -> str | None:
162
+ url = f"{self._base_url}/agent/get_reasoning_last"
163
+ params = {"ticker": ticker, "summary_type": summary_type}
164
+
165
+ try:
166
+ resp = self._session.get(url, params=params, timeout=self._timeout)
167
+ except requests.RequestException as exc:
168
+ raise APIError(f"Request failed: {exc}") from exc
169
+
170
+ if resp.status_code != 200:
171
+ raise APIError(
172
+ f"Unexpected response from API (HTTP {resp.status_code}).",
173
+ status_code=resp.status_code,
174
+ )
175
+
176
+ data: dict[str, Any] = resp.json()
177
+ reasoning = data.get("reasoning")
178
+
179
+ if reasoning is None:
180
+ return None
181
+
182
+ return str(reasoning)
183
+
184
+ @staticmethod
185
+ def _parse_json(raw: str) -> Any:
186
+ try:
187
+ return json.loads(raw)
188
+ except json.JSONDecodeError as exc:
189
+ raise APIError(f"Failed to parse reasoning JSON: {exc}") from exc
@@ -0,0 +1,18 @@
1
+ class SentiMoveError(Exception):
2
+ """Base exception for all SentiMove client errors."""
3
+
4
+
5
+ class AuthenticationError(SentiMoveError):
6
+ """Raised when the API key is missing, invalid, or has insufficient points."""
7
+
8
+
9
+ class APIError(SentiMoveError):
10
+ """Raised when the SentiChain API returns an unexpected response."""
11
+
12
+ def __init__(self, message: str, status_code: int | None = None) -> None:
13
+ self.status_code = status_code
14
+ super().__init__(message)
15
+
16
+
17
+ # Name used by the former fundis package.
18
+ FundisError = SentiMoveError
@@ -0,0 +1,33 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+
5
+
6
+ @dataclass(frozen=True)
7
+ class Event:
8
+ """A single classified sentiment event from the SentiMove pipeline."""
9
+
10
+ timestamp: str
11
+ type: str
12
+ sentiment: str
13
+ summary: str
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class Pattern:
18
+ """A group of converging events sharing common keywords."""
19
+
20
+ keywords: list[str]
21
+ event_indices: list[int]
22
+ description: str = ""
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class Signal:
27
+ """Directional signal from the SentiMove intelligence pipeline."""
28
+
29
+ direction: str
30
+ confidence: float
31
+ rationale: str
32
+ categories: dict[str, str | None] = field(default_factory=dict)
33
+ patterns: list[Pattern] = field(default_factory=list)