pmxt 1.5.7__tar.gz → 1.7.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.
- {pmxt-1.5.7 → pmxt-1.7.0}/PKG-INFO +9 -9
- {pmxt-1.5.7 → pmxt-1.7.0}/README.md +8 -8
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/__init__.py +1 -1
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/api_client.py +1 -1
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/configuration.py +1 -1
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/market_outcome.py +4 -2
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/unified_market.py +4 -2
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/__init__.py +19 -1
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/_server/server/bundled.js +412 -40
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/client.py +222 -2
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/models.py +68 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/server_manager.py +18 -1
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt.egg-info/PKG-INFO +9 -9
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt.egg-info/SOURCES.txt +1 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pyproject.toml +1 -1
- pmxt-1.7.0/tests/test_filtering.py +361 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/api/__init__.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/api/default_api.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/api_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/exceptions.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/__init__.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/balance.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/base_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/base_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/cancel_order_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/create_order200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/create_order_params.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/create_order_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/error_detail.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/error_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/exchange_credentials.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/exchange_credentials_signature_type.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/execution_price_result.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_balance200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_markets200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_markets_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_ohlcv200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_ohlcv_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_ohlcv_request_args_inner.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_open_orders200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_open_orders_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_order_book200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_order_book_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_positions200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_positions_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_trades200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/fetch_trades_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/get_execution_price200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/get_execution_price_detailed200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/get_execution_price_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/get_execution_price_request_args_inner.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/get_markets_by_slug_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/health_check200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/history_filter_params.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/market_filter_params.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/order.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/order_book.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/order_level.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/position.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/price_candle.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/search_events200_response.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/search_events_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/search_markets_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/search_markets_request_args_inner.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/trade.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/unified_event.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/watch_order_book_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/watch_order_book_request_args_inner.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/models/watch_trades_request.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/py.typed +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/generated/pmxt_internal/rest.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/_server/__init__.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/_server/bin/pmxt-ensure-server +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt/_server/bin/pmxt-ensure-server.js +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt.egg-info/dependency_links.txt +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt.egg-info/requires.txt +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/pmxt.egg-info/top_level.txt +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/setup.cfg +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/tests/test_integration.py +0 -0
- {pmxt-1.5.7 → pmxt-1.7.0}/tests/test_server_manager.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pmxt
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Unified prediction market data API - The ccxt for prediction markets
|
|
5
5
|
Author: PMXT Contributors
|
|
6
6
|
License: MIT
|
|
@@ -69,14 +69,14 @@ print(markets[0].title)
|
|
|
69
69
|
outcome = markets[0].outcomes[0]
|
|
70
70
|
print(f"{outcome.label}: {outcome.price * 100:.1f}%")
|
|
71
71
|
|
|
72
|
-
# Fetch historical data (use outcome.
|
|
72
|
+
# Fetch historical data (use outcome.outcome_id!)
|
|
73
73
|
candles = poly.fetch_ohlcv(
|
|
74
|
-
outcome.
|
|
74
|
+
outcome.outcome_id,
|
|
75
75
|
pmxt.HistoryFilterParams(resolution="1d", limit=30)
|
|
76
76
|
)
|
|
77
77
|
|
|
78
78
|
# Get current order book
|
|
79
|
-
order_book = poly.fetch_order_book(outcome.
|
|
79
|
+
order_book = poly.fetch_order_book(outcome.outcome_id)
|
|
80
80
|
spread = order_book.asks[0].price - order_book.bids[0].price
|
|
81
81
|
print(f"Spread: {spread * 100:.2f}%")
|
|
82
82
|
```
|
|
@@ -182,7 +182,7 @@ All methods return clean Python dataclasses:
|
|
|
182
182
|
```python
|
|
183
183
|
@dataclass
|
|
184
184
|
class UnifiedMarket:
|
|
185
|
-
|
|
185
|
+
market_id: str # Use this for create_order
|
|
186
186
|
title: str
|
|
187
187
|
outcomes: List[MarketOutcome]
|
|
188
188
|
volume_24h: float
|
|
@@ -192,7 +192,7 @@ class UnifiedMarket:
|
|
|
192
192
|
|
|
193
193
|
@dataclass
|
|
194
194
|
class MarketOutcome:
|
|
195
|
-
|
|
195
|
+
outcome_id: str # Use this for fetch_ohlcv/fetch_order_book/fetch_trades
|
|
196
196
|
label: str # "Trump", "Yes", etc.
|
|
197
197
|
price: float # 0.0 to 1.0 (probability)
|
|
198
198
|
# ... more fields
|
|
@@ -202,16 +202,16 @@ See the [full API reference](../../API_REFERENCE.md) for complete documentation.
|
|
|
202
202
|
|
|
203
203
|
## Important Notes
|
|
204
204
|
|
|
205
|
-
### Use `outcome.
|
|
205
|
+
### Use `outcome.outcome_id`, not `market.market_id`
|
|
206
206
|
|
|
207
207
|
For deep-dive methods like `fetch_ohlcv()`, `fetch_order_book()`, and `fetch_trades()`, you must use the **outcome ID**, not the market ID:
|
|
208
208
|
|
|
209
209
|
```python
|
|
210
210
|
markets = poly.search_markets("Trump")
|
|
211
|
-
outcome_id = markets[0].outcomes[0].
|
|
211
|
+
outcome_id = markets[0].outcomes[0].outcome_id # Correct
|
|
212
212
|
|
|
213
213
|
candles = poly.fetch_ohlcv(outcome_id, ...) # Works
|
|
214
|
-
candles = poly.fetch_ohlcv(markets[0].
|
|
214
|
+
candles = poly.fetch_ohlcv(markets[0].market_id, ...) # Wrong!
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
### Prices are 0.0 to 1.0
|
|
@@ -35,14 +35,14 @@ print(markets[0].title)
|
|
|
35
35
|
outcome = markets[0].outcomes[0]
|
|
36
36
|
print(f"{outcome.label}: {outcome.price * 100:.1f}%")
|
|
37
37
|
|
|
38
|
-
# Fetch historical data (use outcome.
|
|
38
|
+
# Fetch historical data (use outcome.outcome_id!)
|
|
39
39
|
candles = poly.fetch_ohlcv(
|
|
40
|
-
outcome.
|
|
40
|
+
outcome.outcome_id,
|
|
41
41
|
pmxt.HistoryFilterParams(resolution="1d", limit=30)
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
# Get current order book
|
|
45
|
-
order_book = poly.fetch_order_book(outcome.
|
|
45
|
+
order_book = poly.fetch_order_book(outcome.outcome_id)
|
|
46
46
|
spread = order_book.asks[0].price - order_book.bids[0].price
|
|
47
47
|
print(f"Spread: {spread * 100:.2f}%")
|
|
48
48
|
```
|
|
@@ -148,7 +148,7 @@ All methods return clean Python dataclasses:
|
|
|
148
148
|
```python
|
|
149
149
|
@dataclass
|
|
150
150
|
class UnifiedMarket:
|
|
151
|
-
|
|
151
|
+
market_id: str # Use this for create_order
|
|
152
152
|
title: str
|
|
153
153
|
outcomes: List[MarketOutcome]
|
|
154
154
|
volume_24h: float
|
|
@@ -158,7 +158,7 @@ class UnifiedMarket:
|
|
|
158
158
|
|
|
159
159
|
@dataclass
|
|
160
160
|
class MarketOutcome:
|
|
161
|
-
|
|
161
|
+
outcome_id: str # Use this for fetch_ohlcv/fetch_order_book/fetch_trades
|
|
162
162
|
label: str # "Trump", "Yes", etc.
|
|
163
163
|
price: float # 0.0 to 1.0 (probability)
|
|
164
164
|
# ... more fields
|
|
@@ -168,16 +168,16 @@ See the [full API reference](../../API_REFERENCE.md) for complete documentation.
|
|
|
168
168
|
|
|
169
169
|
## Important Notes
|
|
170
170
|
|
|
171
|
-
### Use `outcome.
|
|
171
|
+
### Use `outcome.outcome_id`, not `market.market_id`
|
|
172
172
|
|
|
173
173
|
For deep-dive methods like `fetch_ohlcv()`, `fetch_order_book()`, and `fetch_trades()`, you must use the **outcome ID**, not the market ID:
|
|
174
174
|
|
|
175
175
|
```python
|
|
176
176
|
markets = poly.search_markets("Trump")
|
|
177
|
-
outcome_id = markets[0].outcomes[0].
|
|
177
|
+
outcome_id = markets[0].outcomes[0].outcome_id # Correct
|
|
178
178
|
|
|
179
179
|
candles = poly.fetch_ohlcv(outcome_id, ...) # Works
|
|
180
|
-
candles = poly.fetch_ohlcv(markets[0].
|
|
180
|
+
candles = poly.fetch_ohlcv(markets[0].market_id, ...) # Wrong!
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
### Prices are 0.0 to 1.0
|
|
@@ -91,7 +91,7 @@ class ApiClient:
|
|
|
91
91
|
self.default_headers[header_name] = header_value
|
|
92
92
|
self.cookie = cookie
|
|
93
93
|
# Set default User-Agent.
|
|
94
|
-
self.user_agent = 'OpenAPI-Generator/1.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/1.7.0/python'
|
|
95
95
|
self.client_side_validation = configuration.client_side_validation
|
|
96
96
|
|
|
97
97
|
def __enter__(self):
|
|
@@ -506,7 +506,7 @@ class Configuration:
|
|
|
506
506
|
"OS: {env}\n"\
|
|
507
507
|
"Python Version: {pyversion}\n"\
|
|
508
508
|
"Version of the API: 0.4.4\n"\
|
|
509
|
-
"SDK Package Version: 1.
|
|
509
|
+
"SDK Package Version: 1.7.0".\
|
|
510
510
|
format(env=sys.platform, pyversion=sys.version)
|
|
511
511
|
|
|
512
512
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -26,12 +26,13 @@ class MarketOutcome(BaseModel):
|
|
|
26
26
|
"""
|
|
27
27
|
MarketOutcome
|
|
28
28
|
""" # noqa: E501
|
|
29
|
-
id: Optional[StrictStr] = None
|
|
29
|
+
id: Optional[StrictStr] = Field(default=None, description="DEPRECATED: Use outcomeId instead. Will be removed in v2.0")
|
|
30
|
+
outcome_id: Optional[StrictStr] = Field(default=None, description="Outcome ID for trading operations (CLOB Token ID for Polymarket, Market Ticker for Kalshi)", alias="outcomeId")
|
|
30
31
|
label: Optional[StrictStr] = None
|
|
31
32
|
price: Optional[Union[StrictFloat, StrictInt]] = None
|
|
32
33
|
price_change24h: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="priceChange24h")
|
|
33
34
|
metadata: Optional[Dict[str, Any]] = Field(default=None, description="Exchange-specific metadata (e.g., clobTokenId for Polymarket)")
|
|
34
|
-
__properties: ClassVar[List[str]] = ["id", "label", "price", "priceChange24h", "metadata"]
|
|
35
|
+
__properties: ClassVar[List[str]] = ["id", "outcomeId", "label", "price", "priceChange24h", "metadata"]
|
|
35
36
|
|
|
36
37
|
model_config = ConfigDict(
|
|
37
38
|
populate_by_name=True,
|
|
@@ -85,6 +86,7 @@ class MarketOutcome(BaseModel):
|
|
|
85
86
|
|
|
86
87
|
_obj = cls.model_validate({
|
|
87
88
|
"id": obj.get("id"),
|
|
89
|
+
"outcomeId": obj.get("outcomeId"),
|
|
88
90
|
"label": obj.get("label"),
|
|
89
91
|
"price": obj.get("price"),
|
|
90
92
|
"priceChange24h": obj.get("priceChange24h"),
|
|
@@ -28,7 +28,8 @@ class UnifiedMarket(BaseModel):
|
|
|
28
28
|
"""
|
|
29
29
|
UnifiedMarket
|
|
30
30
|
""" # noqa: E501
|
|
31
|
-
id: Optional[StrictStr] = None
|
|
31
|
+
id: Optional[StrictStr] = Field(default=None, description="DEPRECATED: Use marketId instead. Will be removed in v2.0")
|
|
32
|
+
market_id: Optional[StrictStr] = Field(default=None, description="The unique identifier for this market", alias="marketId")
|
|
32
33
|
title: Optional[StrictStr] = None
|
|
33
34
|
description: Optional[StrictStr] = None
|
|
34
35
|
outcomes: Optional[List[MarketOutcome]] = None
|
|
@@ -45,7 +46,7 @@ class UnifiedMarket(BaseModel):
|
|
|
45
46
|
no: Optional[MarketOutcome] = None
|
|
46
47
|
up: Optional[MarketOutcome] = None
|
|
47
48
|
down: Optional[MarketOutcome] = None
|
|
48
|
-
__properties: ClassVar[List[str]] = ["id", "title", "description", "outcomes", "resolutionDate", "volume24h", "volume", "liquidity", "openInterest", "url", "image", "category", "tags", "yes", "no", "up", "down"]
|
|
49
|
+
__properties: ClassVar[List[str]] = ["id", "marketId", "title", "description", "outcomes", "resolutionDate", "volume24h", "volume", "liquidity", "openInterest", "url", "image", "category", "tags", "yes", "no", "up", "down"]
|
|
49
50
|
|
|
50
51
|
model_config = ConfigDict(
|
|
51
52
|
populate_by_name=True,
|
|
@@ -118,6 +119,7 @@ class UnifiedMarket(BaseModel):
|
|
|
118
119
|
|
|
119
120
|
_obj = cls.model_validate({
|
|
120
121
|
"id": obj.get("id"),
|
|
122
|
+
"marketId": obj.get("marketId"),
|
|
121
123
|
"title": obj.get("title"),
|
|
122
124
|
"description": obj.get("description"),
|
|
123
125
|
"outcomes": [MarketOutcome.from_dict(_item) for _item in obj["outcomes"]] if obj.get("outcomes") is not None else None,
|
|
@@ -33,7 +33,23 @@ from .models import (
|
|
|
33
33
|
CreateOrderParams,
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
# Global server management functions
|
|
38
|
+
_default_manager = ServerManager()
|
|
39
|
+
|
|
40
|
+
def stop_server():
|
|
41
|
+
"""
|
|
42
|
+
Stop the background PMXT sidecar server.
|
|
43
|
+
"""
|
|
44
|
+
_default_manager.stop()
|
|
45
|
+
|
|
46
|
+
def restart_server():
|
|
47
|
+
"""
|
|
48
|
+
Restart the background PMXT sidecar server.
|
|
49
|
+
"""
|
|
50
|
+
_default_manager.restart()
|
|
51
|
+
|
|
52
|
+
__version__ = "1.7.0"
|
|
37
53
|
__all__ = [
|
|
38
54
|
# Exchanges
|
|
39
55
|
"Polymarket",
|
|
@@ -42,6 +58,8 @@ __all__ = [
|
|
|
42
58
|
"Exchange",
|
|
43
59
|
# Server Management
|
|
44
60
|
"ServerManager",
|
|
61
|
+
"stop_server",
|
|
62
|
+
"restart_server",
|
|
45
63
|
# Data Models
|
|
46
64
|
"UnifiedMarket",
|
|
47
65
|
"MarketOutcome",
|