oddspipe 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.
oddspipe-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 OddsPipe
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,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: oddspipe
3
+ Version: 0.1.0
4
+ Summary: Python client for the OddsPipe prediction market API
5
+ Home-page: https://oddspipe.com
6
+ Author: OddsPipe
7
+ Author-email: hello@oddspipe.com
8
+ License: MIT
9
+ Project-URL: Documentation, https://oddspipe.com/docs
10
+ Project-URL: Source, https://github.com/OddsPipe/oddspipe
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.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: httpx
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license
27
+ Dynamic: license-file
28
+ Dynamic: project-url
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ # OddsPipe Python SDK
34
+
35
+ Python client for the [OddsPipe](https://oddspipe.com) prediction market API.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install oddspipe
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```python
46
+ from oddspipe import OddsPipe
47
+
48
+ client = OddsPipe(api_key="your-api-key")
49
+
50
+ # List top markets by volume
51
+ markets = client.markets(limit=10)
52
+ for m in markets["items"]:
53
+ print(m["title"], m["spread"])
54
+
55
+ # Search for a market
56
+ results = client.search("Trump", platform="polymarket")
57
+
58
+ # Get OHLCV candlesticks
59
+ candles = client.candlesticks(market_id=123, interval="1h", limit=100)
60
+ for c in candles["candles"]:
61
+ print(c["timestamp"], c["close"], c["volume"])
62
+
63
+ # Find cross-platform price divergences
64
+ spreads = client.spreads(min_spread=0.03)
65
+ for item in spreads["items"]:
66
+ print(item["title"], item["spread"]["yes_diff"])
67
+
68
+ # Cross-platform spread for a single market
69
+ spread = client.spread(market_id=123)
70
+ print(spread["sources"])
71
+ print(spread["spread"])
72
+ ```
73
+
74
+ ## API reference
75
+
76
+ | Method | Endpoint | Description |
77
+ |--------|----------|-------------|
78
+ | `markets()` | `GET /v1/markets` | List markets with latest prices |
79
+ | `market(id)` | `GET /v1/markets/{id}` | Single market detail |
80
+ | `search(q)` | `GET /v1/markets/search` | Full-text search |
81
+ | `history(id)` | `GET /v1/markets/{id}/history` | Raw price snapshots |
82
+ | `candlesticks(id)` | `GET /v1/markets/{id}/candlesticks` | OHLCV candles (1m/5m/1h/1d) |
83
+ | `spread(id)` | `GET /v1/markets/{id}/spread` | Cross-platform spread |
84
+ | `spreads()` | `GET /v1/spreads` | Cross-platform price spreads |
85
+
86
+ ## Error handling
87
+
88
+ ```python
89
+ from oddspipe import OddsPipe, OddsPipeError
90
+
91
+ client = OddsPipe(api_key="your-key")
92
+ try:
93
+ client.market(999999)
94
+ except OddsPipeError as e:
95
+ print(e.status_code) # 404
96
+ print(e.body) # {"detail": "Market not found"}
97
+ ```
@@ -0,0 +1,65 @@
1
+ # OddsPipe Python SDK
2
+
3
+ Python client for the [OddsPipe](https://oddspipe.com) prediction market API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install oddspipe
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```python
14
+ from oddspipe import OddsPipe
15
+
16
+ client = OddsPipe(api_key="your-api-key")
17
+
18
+ # List top markets by volume
19
+ markets = client.markets(limit=10)
20
+ for m in markets["items"]:
21
+ print(m["title"], m["spread"])
22
+
23
+ # Search for a market
24
+ results = client.search("Trump", platform="polymarket")
25
+
26
+ # Get OHLCV candlesticks
27
+ candles = client.candlesticks(market_id=123, interval="1h", limit=100)
28
+ for c in candles["candles"]:
29
+ print(c["timestamp"], c["close"], c["volume"])
30
+
31
+ # Find cross-platform price divergences
32
+ spreads = client.spreads(min_spread=0.03)
33
+ for item in spreads["items"]:
34
+ print(item["title"], item["spread"]["yes_diff"])
35
+
36
+ # Cross-platform spread for a single market
37
+ spread = client.spread(market_id=123)
38
+ print(spread["sources"])
39
+ print(spread["spread"])
40
+ ```
41
+
42
+ ## API reference
43
+
44
+ | Method | Endpoint | Description |
45
+ |--------|----------|-------------|
46
+ | `markets()` | `GET /v1/markets` | List markets with latest prices |
47
+ | `market(id)` | `GET /v1/markets/{id}` | Single market detail |
48
+ | `search(q)` | `GET /v1/markets/search` | Full-text search |
49
+ | `history(id)` | `GET /v1/markets/{id}/history` | Raw price snapshots |
50
+ | `candlesticks(id)` | `GET /v1/markets/{id}/candlesticks` | OHLCV candles (1m/5m/1h/1d) |
51
+ | `spread(id)` | `GET /v1/markets/{id}/spread` | Cross-platform spread |
52
+ | `spreads()` | `GET /v1/spreads` | Cross-platform price spreads |
53
+
54
+ ## Error handling
55
+
56
+ ```python
57
+ from oddspipe import OddsPipe, OddsPipeError
58
+
59
+ client = OddsPipe(api_key="your-key")
60
+ try:
61
+ client.market(999999)
62
+ except OddsPipeError as e:
63
+ print(e.status_code) # 404
64
+ print(e.body) # {"detail": "Market not found"}
65
+ ```
@@ -0,0 +1,4 @@
1
+ from .client import OddsPipe, OddsPipeError
2
+
3
+ __all__ = ["OddsPipe", "OddsPipeError"]
4
+ __version__ = "0.1.0"
@@ -0,0 +1,146 @@
1
+ """Synchronous Python client for the OddsPipe prediction market API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+
8
+ class OddsPipeError(Exception):
9
+ """Raised when the API returns a non-200 response."""
10
+
11
+ def __init__(self, status_code: int, body: dict | str):
12
+ self.status_code = status_code
13
+ self.body = body
14
+ detail = body.get("detail", body) if isinstance(body, dict) else body
15
+ super().__init__(f"HTTP {status_code}: {detail}")
16
+
17
+
18
+ class OddsPipe:
19
+ """Synchronous client for the OddsPipe API.
20
+
21
+ Usage::
22
+
23
+ client = OddsPipe(api_key="your-key")
24
+ markets = client.markets(limit=10)
25
+ """
26
+
27
+ def __init__(
28
+ self,
29
+ api_key: str,
30
+ base_url: str = "https://oddspipe.com",
31
+ timeout: float = 30.0,
32
+ ):
33
+ self._base_url = base_url.rstrip("/")
34
+ self._client = httpx.Client(
35
+ base_url=f"{self._base_url}/v1",
36
+ headers={"X-API-Key": api_key},
37
+ timeout=timeout,
38
+ )
39
+
40
+ def _request(self, method: str, path: str, params: dict | None = None) -> dict:
41
+ resp = self._client.request(method, path, params=params)
42
+ if resp.status_code != 200:
43
+ try:
44
+ body = resp.json()
45
+ except Exception:
46
+ body = resp.text
47
+ raise OddsPipeError(resp.status_code, body)
48
+ return resp.json()
49
+
50
+ def _clean(self, params: dict) -> dict:
51
+ return {k: v for k, v in params.items() if v is not None}
52
+
53
+ # ----- endpoints -----
54
+
55
+ def markets(
56
+ self,
57
+ limit: int = 50,
58
+ offset: int = 0,
59
+ search: str | None = None,
60
+ status: str | None = None,
61
+ ) -> dict:
62
+ """List markets with sources and latest prices."""
63
+ return self._request("GET", "/markets", self._clean({
64
+ "limit": limit,
65
+ "offset": offset,
66
+ "search": search,
67
+ "status": status,
68
+ }))
69
+
70
+ def market(self, market_id: int) -> dict:
71
+ """Get a single market with all sources and latest snapshot per source."""
72
+ return self._request("GET", f"/markets/{market_id}")
73
+
74
+ def search(
75
+ self,
76
+ q: str,
77
+ platform: str | None = None,
78
+ status: str | None = None,
79
+ limit: int = 20,
80
+ offset: int = 0,
81
+ ) -> dict:
82
+ """Full-text search across market titles."""
83
+ return self._request("GET", "/markets/search", self._clean({
84
+ "q": q,
85
+ "platform": platform,
86
+ "status": status,
87
+ "limit": limit,
88
+ "offset": offset,
89
+ }))
90
+
91
+ def history(
92
+ self,
93
+ market_id: int,
94
+ source: str | None = None,
95
+ since: str | None = None,
96
+ ) -> dict:
97
+ """Get all price snapshots for a market."""
98
+ return self._request("GET", f"/markets/{market_id}/history", self._clean({
99
+ "source": source,
100
+ "since": since,
101
+ }))
102
+
103
+ def candlesticks(
104
+ self,
105
+ market_id: int,
106
+ interval: str = "1h",
107
+ source: str | None = None,
108
+ start: str | None = None,
109
+ end: str | None = None,
110
+ limit: int = 500,
111
+ ) -> dict:
112
+ """Get OHLCV candlestick data for a market."""
113
+ return self._request("GET", f"/markets/{market_id}/candlesticks", self._clean({
114
+ "interval": interval,
115
+ "source": source,
116
+ "start": start,
117
+ "end": end,
118
+ "limit": limit,
119
+ }))
120
+
121
+ def spread(self, market_id: int) -> dict:
122
+ """Get cross-platform spread for a single market."""
123
+ return self._request("GET", f"/markets/{market_id}/spread")
124
+
125
+ def spreads(
126
+ self,
127
+ limit: int = 50,
128
+ offset: int = 0,
129
+ min_spread: float | None = None,
130
+ ) -> dict:
131
+ """List all markets with cross-platform spreads, sorted by largest spread."""
132
+ return self._request("GET", "/spreads", self._clean({
133
+ "limit": limit,
134
+ "offset": offset,
135
+ "min_spread": min_spread,
136
+ }))
137
+
138
+ def close(self):
139
+ """Close the underlying HTTP client."""
140
+ self._client.close()
141
+
142
+ def __enter__(self):
143
+ return self
144
+
145
+ def __exit__(self, *args):
146
+ self.close()
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: oddspipe
3
+ Version: 0.1.0
4
+ Summary: Python client for the OddsPipe prediction market API
5
+ Home-page: https://oddspipe.com
6
+ Author: OddsPipe
7
+ Author-email: hello@oddspipe.com
8
+ License: MIT
9
+ Project-URL: Documentation, https://oddspipe.com/docs
10
+ Project-URL: Source, https://github.com/OddsPipe/oddspipe
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.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: httpx
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: license
27
+ Dynamic: license-file
28
+ Dynamic: project-url
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ # OddsPipe Python SDK
34
+
35
+ Python client for the [OddsPipe](https://oddspipe.com) prediction market API.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ pip install oddspipe
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```python
46
+ from oddspipe import OddsPipe
47
+
48
+ client = OddsPipe(api_key="your-api-key")
49
+
50
+ # List top markets by volume
51
+ markets = client.markets(limit=10)
52
+ for m in markets["items"]:
53
+ print(m["title"], m["spread"])
54
+
55
+ # Search for a market
56
+ results = client.search("Trump", platform="polymarket")
57
+
58
+ # Get OHLCV candlesticks
59
+ candles = client.candlesticks(market_id=123, interval="1h", limit=100)
60
+ for c in candles["candles"]:
61
+ print(c["timestamp"], c["close"], c["volume"])
62
+
63
+ # Find cross-platform price divergences
64
+ spreads = client.spreads(min_spread=0.03)
65
+ for item in spreads["items"]:
66
+ print(item["title"], item["spread"]["yes_diff"])
67
+
68
+ # Cross-platform spread for a single market
69
+ spread = client.spread(market_id=123)
70
+ print(spread["sources"])
71
+ print(spread["spread"])
72
+ ```
73
+
74
+ ## API reference
75
+
76
+ | Method | Endpoint | Description |
77
+ |--------|----------|-------------|
78
+ | `markets()` | `GET /v1/markets` | List markets with latest prices |
79
+ | `market(id)` | `GET /v1/markets/{id}` | Single market detail |
80
+ | `search(q)` | `GET /v1/markets/search` | Full-text search |
81
+ | `history(id)` | `GET /v1/markets/{id}/history` | Raw price snapshots |
82
+ | `candlesticks(id)` | `GET /v1/markets/{id}/candlesticks` | OHLCV candles (1m/5m/1h/1d) |
83
+ | `spread(id)` | `GET /v1/markets/{id}/spread` | Cross-platform spread |
84
+ | `spreads()` | `GET /v1/spreads` | Cross-platform price spreads |
85
+
86
+ ## Error handling
87
+
88
+ ```python
89
+ from oddspipe import OddsPipe, OddsPipeError
90
+
91
+ client = OddsPipe(api_key="your-key")
92
+ try:
93
+ client.market(999999)
94
+ except OddsPipeError as e:
95
+ print(e.status_code) # 404
96
+ print(e.body) # {"detail": "Market not found"}
97
+ ```
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ oddspipe/__init__.py
5
+ oddspipe/client.py
6
+ oddspipe.egg-info/PKG-INFO
7
+ oddspipe.egg-info/SOURCES.txt
8
+ oddspipe.egg-info/dependency_links.txt
9
+ oddspipe.egg-info/requires.txt
10
+ oddspipe.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ httpx
@@ -0,0 +1 @@
1
+ oddspipe
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", encoding="utf-8") as f:
4
+ long_description = f.read()
5
+
6
+ setup(
7
+ name="oddspipe",
8
+ version="0.1.0",
9
+ description="Python client for the OddsPipe prediction market API",
10
+ long_description=long_description,
11
+ long_description_content_type="text/markdown",
12
+ author="OddsPipe",
13
+ author_email="hello@oddspipe.com",
14
+ url="https://oddspipe.com",
15
+ project_urls={
16
+ "Documentation": "https://oddspipe.com/docs",
17
+ "Source": "https://github.com/OddsPipe/oddspipe",
18
+ },
19
+ packages=find_packages(),
20
+ install_requires=["httpx"],
21
+ python_requires=">=3.8",
22
+ license="MIT",
23
+ classifiers=[
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Developers",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Programming Language :: Python :: 3",
28
+ "Topic :: Office/Business :: Financial",
29
+ ],
30
+ )