helix-python 0.2.0__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.
helix/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ from helix.client import HelixClient
2
+
3
+ __all__ = ["HelixClient"]
helix/client.py ADDED
@@ -0,0 +1,122 @@
1
+ """Official Helix Python SDK — market grounding for AI agents."""
2
+ from __future__ import annotations
3
+
4
+ import time
5
+ from typing import Any
6
+
7
+ import requests
8
+
9
+
10
+ class HelixError(Exception):
11
+ pass
12
+
13
+
14
+ class HelixClient:
15
+ def __init__(
16
+ self,
17
+ api_key: str,
18
+ base_url: str = "https://helixread.com",
19
+ timeout: int = 30,
20
+ max_retries: int = 3,
21
+ ):
22
+ self.api_key = api_key
23
+ self.base_url = base_url.rstrip("/")
24
+ self.timeout = timeout
25
+ self.max_retries = max_retries
26
+ self._session = requests.Session()
27
+ self._session.headers["X-API-Key"] = api_key
28
+
29
+ def _request(self, method: str, path: str, **kwargs) -> Any:
30
+ url = f"{self.base_url}{path}"
31
+ last_err: Exception | None = None
32
+ for attempt in range(self.max_retries):
33
+ try:
34
+ r = self._session.request(method, url, timeout=self.timeout, **kwargs)
35
+ if r.status_code == 429:
36
+ wait = int(r.headers.get("Retry-After", 2 ** attempt))
37
+ time.sleep(min(wait, 60))
38
+ continue
39
+ if r.status_code >= 400:
40
+ raise HelixError(f"{r.status_code}: {r.text[:500]}")
41
+ return r.json()
42
+ except requests.RequestException as e:
43
+ last_err = e
44
+ time.sleep(2 ** attempt)
45
+ raise HelixError(str(last_err))
46
+
47
+ def health(self) -> dict:
48
+ return self._request("GET", "/health")
49
+
50
+ def get_context(
51
+ self,
52
+ symbols: list[str] | None = None,
53
+ *,
54
+ depth: str = "standard",
55
+ modules: str | None = None,
56
+ since: str | None = None,
57
+ citations: bool = False,
58
+ corpus_q: str | None = None,
59
+ ) -> dict:
60
+ params: dict[str, Any] = {"depth": depth}
61
+ if symbols:
62
+ params["symbols"] = ",".join(symbols)
63
+ if modules:
64
+ params["modules"] = modules
65
+ if since:
66
+ params["since"] = since
67
+ if citations:
68
+ params["citations"] = "true"
69
+ if corpus_q:
70
+ params["corpus_q"] = corpus_q
71
+ return self._request("GET", "/agent/context", params=params)
72
+
73
+ def ticker(self, symbol: str) -> dict:
74
+ return self._request("GET", f"/ticker/{symbol.upper()}")
75
+
76
+ def search(self, query: str) -> dict:
77
+ return self._request("GET", "/search", params={"q": query})
78
+
79
+ def read(self, url: str) -> dict:
80
+ return self._request("GET", "/read", params={"url": url})
81
+
82
+ def create_session(
83
+ self, symbols: list[str], *, depth: str = "standard", modules: str | None = None,
84
+ ) -> dict:
85
+ body = {"symbols": symbols, "depth": depth}
86
+ if modules:
87
+ body["modules"] = modules
88
+ return self._request("POST", "/agent/session", json=body)
89
+
90
+ def refresh_session(self, session_id: str) -> dict:
91
+ return self._request("GET", f"/agent/session/{session_id}/refresh")
92
+
93
+ def guard_validate(self, llm_output: str, *, session_id: str | None = None, context: dict | None = None) -> dict:
94
+ body: dict[str, Any] = {"llm_output": llm_output}
95
+ if session_id:
96
+ body["session_id"] = session_id
97
+ if context:
98
+ body["context"] = context
99
+ return self._request("POST", "/guard/validate", json=body)
100
+
101
+ def register_webhook(self, url: str, events: list[str]) -> dict:
102
+ return self._request("POST", "/webhooks", json={"url": url, "events": events})
103
+
104
+ def set_watchlist(self, symbols: list[str], *, email: str = "", webhook_url: str = "") -> dict:
105
+ body: dict = {"symbols": symbols}
106
+ if email:
107
+ body["email"] = email
108
+ if webhook_url:
109
+ body["webhook_url"] = webhook_url
110
+ return self._request("POST", "/brief/watchlist", json=body)
111
+
112
+ def personal_brief(self, symbols: list[str] | None = None) -> dict:
113
+ params = {}
114
+ if symbols:
115
+ params["symbols"] = ",".join(symbols)
116
+ return self._request("GET", "/brief/personal", params=params)
117
+
118
+ def pricing_plans(self) -> dict:
119
+ return self._request("GET", "/pricing/plans")
120
+
121
+ def regime_history(self, days: int = 365) -> dict:
122
+ return self._request("GET", "/research/regime-history", params={"days": days})
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: helix-python
3
+ Version: 0.2.0
4
+ Summary: Official Helix SDK — market grounding for AI agents
5
+ Project-URL: Homepage, https://helixread.com
6
+ Project-URL: Documentation, https://helixread.com/developers
7
+ Author-email: Helix <hello@helixread.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agents,finance,grounding,helix,llm,market-data
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Office/Business :: Financial
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: requests>=2.28
18
+ Provides-Extra: dev
19
+ Requires-Dist: build; extra == 'dev'
20
+ Requires-Dist: pytest; extra == 'dev'
21
+ Requires-Dist: twine; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # helix-python
25
+
26
+ Official Python SDK for [Helix](https://helixread.com) — market grounding for AI agents.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install helix-python
32
+ ```
33
+
34
+ Grab a free API key (250 requests/day, no card) at [helixread.com](https://helixread.com).
35
+
36
+ ## Quickstart
37
+
38
+ ```python
39
+ from helix import HelixClient
40
+
41
+ hx = HelixClient(api_key="hx_...", base_url="https://helixread.com")
42
+ ctx = hx.get_context(["NVDA", "AMD"], depth="deep", citations=True)
43
+ print(ctx["regime"], ctx.get("peers"))
44
+ ```
45
+
46
+ ## Features (v0.2.0)
47
+
48
+ - `get_context()` — depth, modules, since-diff, citations
49
+ - `create_session()` / `refresh_session()` — versioned grounding
50
+ - `guard_validate()` — Helix Guard anti-hallucination
51
+ - `register_webhook()`, `set_watchlist()`, `personal_brief()`
52
+ - `regime_history()` — Research API tier
53
+
54
+ ## Starter agents
55
+
56
+ Download agent zips from [helixread.com/agents](https://helixread.com/agents) (free API key required).
57
+
58
+ ## Docs
59
+
60
+ - API reference: https://helixread.com/developers
61
+ - OpenAPI: https://helixread.com/docs
@@ -0,0 +1,6 @@
1
+ helix/__init__.py,sha256=awMtFqE7tIXGIvfJi0gZfudhYwclBze3T5imjSPm0Ck,63
2
+ helix/client.py,sha256=Kx3rYv1DumKsqDK1FqQVZJzMN46xFlYoYjcFc6GZxQQ,4297
3
+ helix_python-0.2.0.dist-info/METADATA,sha256=8D9yZw7BrFB_SQNyA_cGas9bTyYa4U40ox9C7O3DJ7g,1850
4
+ helix_python-0.2.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
5
+ helix_python-0.2.0.dist-info/licenses/LICENSE,sha256=Bt4B5UZee5n7bKJmEDlp9SDu21rMW2XboItq2AuP1Ho,1061
6
+ helix_python-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Helix
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.