pmxt 1.0.3__tar.gz → 1.0.4__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.0.3 → pmxt-1.0.4}/PKG-INFO +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/__init__.py +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/api_client.py +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/configuration.py +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/__init__.py +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/_server/server/bundled.js +4 -2
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/client.py +6 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/server_manager.py +51 -4
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt.egg-info/PKG-INFO +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/pyproject.toml +1 -1
- {pmxt-1.0.3 → pmxt-1.0.4}/README.md +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/api/__init__.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/api/default_api.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/api_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/exceptions.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/__init__.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/balance.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/base_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/base_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/cancel_order_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/create_order200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/create_order_params.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/create_order_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/error_detail.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/error_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/exchange_credentials.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_balance200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_markets200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_markets_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_ohlcv200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_ohlcv_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_ohlcv_request_args_inner.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_open_orders200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_open_orders_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_order_book200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_order_book_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_positions200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_positions_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_trades200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/fetch_trades_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/get_markets_by_slug_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/health_check200_response.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/history_filter_params.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/market_filter_params.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/market_outcome.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/order.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/order_book.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/order_level.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/position.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/price_candle.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/search_markets_request.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/search_markets_request_args_inner.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/trade.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/unified_market.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/py.typed +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/rest.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/_server/__init__.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/_server/bin/pmxt-ensure-server +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt/models.py +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt.egg-info/SOURCES.txt +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt.egg-info/dependency_links.txt +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt.egg-info/requires.txt +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/pmxt.egg-info/top_level.txt +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/setup.cfg +0 -0
- {pmxt-1.0.3 → pmxt-1.0.4}/tests/test_integration.py +0 -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.0.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/1.0.4/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.0.
|
|
509
|
+
"SDK Package Version: 1.0.4".\
|
|
510
510
|
format(env=sys.platform, pyversion=sys.version)
|
|
511
511
|
|
|
512
512
|
def get_host_settings(self) -> List[HostSetting]:
|
|
@@ -83381,6 +83381,7 @@ var require_fetchMarkets2 = __commonJS({
|
|
|
83381
83381
|
}
|
|
83382
83382
|
async function fetchMarkets(params) {
|
|
83383
83383
|
const limit = params?.limit || 50;
|
|
83384
|
+
const offset = params?.offset || 0;
|
|
83384
83385
|
const now = Date.now();
|
|
83385
83386
|
try {
|
|
83386
83387
|
let events;
|
|
@@ -83389,8 +83390,9 @@ var require_fetchMarkets2 = __commonJS({
|
|
|
83389
83390
|
events = cachedEvents;
|
|
83390
83391
|
seriesMap = cachedSeriesMap;
|
|
83391
83392
|
} else {
|
|
83393
|
+
const fetchLimit = 1e3;
|
|
83392
83394
|
const [allEvents, fetchedSeriesMap] = await Promise.all([
|
|
83393
|
-
fetchActiveEvents(
|
|
83395
|
+
fetchActiveEvents(fetchLimit),
|
|
83394
83396
|
fetchSeriesMap()
|
|
83395
83397
|
]);
|
|
83396
83398
|
events = allEvents;
|
|
@@ -83419,7 +83421,7 @@ var require_fetchMarkets2 = __commonJS({
|
|
|
83419
83421
|
} else if (params?.sort === "liquidity") {
|
|
83420
83422
|
allMarkets.sort((a, b) => b.liquidity - a.liquidity);
|
|
83421
83423
|
}
|
|
83422
|
-
return allMarkets.slice(
|
|
83424
|
+
return allMarkets.slice(offset, offset + limit);
|
|
83423
83425
|
} catch (error) {
|
|
83424
83426
|
console.error("Error fetching Kalshi data:", error);
|
|
83425
83427
|
return [];
|
|
@@ -198,6 +198,12 @@ class Exchange(ABC):
|
|
|
198
198
|
# Configure the API client with the actual base URL
|
|
199
199
|
config = Configuration(host=base_url)
|
|
200
200
|
self._api_client = ApiClient(configuration=config)
|
|
201
|
+
|
|
202
|
+
# Add access token from lock file
|
|
203
|
+
server_info = self._server_manager.get_server_info()
|
|
204
|
+
if server_info and 'accessToken' in server_info:
|
|
205
|
+
self._api_client.default_headers['x-pmxt-access-token'] = server_info['accessToken']
|
|
206
|
+
|
|
201
207
|
self._api = DefaultApi(api_client=self._api_client)
|
|
202
208
|
|
|
203
209
|
def _handle_response(self, response: Dict[str, Any]) -> Any:
|
|
@@ -69,15 +69,62 @@ class ServerManager:
|
|
|
69
69
|
Raises:
|
|
70
70
|
Exception: If server fails to start or become healthy
|
|
71
71
|
"""
|
|
72
|
-
# Step 1: Check if
|
|
72
|
+
# Step 1: Check if force restart is requested (DEV MODE)
|
|
73
|
+
if os.getenv('PMXT_ALWAYS_RESTART') == '1':
|
|
74
|
+
self._kill_old_server()
|
|
75
|
+
|
|
76
|
+
# Step 2: Check if server is already running and matches version
|
|
73
77
|
if self.is_server_alive():
|
|
74
|
-
|
|
78
|
+
if self._is_version_mismatch():
|
|
79
|
+
# print("PMXT: Version mismatch detected. Restarting server...")
|
|
80
|
+
self._kill_old_server()
|
|
81
|
+
else:
|
|
82
|
+
return
|
|
75
83
|
|
|
76
|
-
# Step
|
|
84
|
+
# Step 3: Start server via launcher
|
|
77
85
|
self._start_server_via_launcher()
|
|
78
86
|
|
|
79
|
-
# Step
|
|
87
|
+
# Step 4: Wait for health check
|
|
80
88
|
self._wait_for_health()
|
|
89
|
+
|
|
90
|
+
def _is_version_mismatch(self) -> bool:
|
|
91
|
+
"""Check if running server version matches expected version."""
|
|
92
|
+
server_info = self.get_server_info()
|
|
93
|
+
if not server_info or 'version' not in server_info:
|
|
94
|
+
return True # Old server without version
|
|
95
|
+
|
|
96
|
+
# Get expected version
|
|
97
|
+
try:
|
|
98
|
+
# 1. Check production path (bundled)
|
|
99
|
+
pkg_path = Path(__file__).parent / '_server' / 'package.json'
|
|
100
|
+
|
|
101
|
+
# 2. Check dev path (monorepo)
|
|
102
|
+
if not pkg_path.exists():
|
|
103
|
+
# Traverse up to find core/package.json
|
|
104
|
+
pkg_path = Path(__file__).parent.parent.parent.parent / 'core' / 'package.json'
|
|
105
|
+
|
|
106
|
+
if pkg_path.exists():
|
|
107
|
+
data = json.loads(pkg_path.read_text())
|
|
108
|
+
expected_version = data.get('version')
|
|
109
|
+
if expected_version and not server_info['version'].startswith(expected_version):
|
|
110
|
+
return True
|
|
111
|
+
except:
|
|
112
|
+
pass
|
|
113
|
+
|
|
114
|
+
return False
|
|
115
|
+
|
|
116
|
+
def _kill_old_server(self) -> None:
|
|
117
|
+
"""Kill the currently running server."""
|
|
118
|
+
server_info = self.get_server_info()
|
|
119
|
+
if server_info and 'pid' in server_info:
|
|
120
|
+
import signal
|
|
121
|
+
try:
|
|
122
|
+
os.kill(server_info['pid'], signal.SIGTERM)
|
|
123
|
+
# Brief wait for cleanup
|
|
124
|
+
time.sleep(0.5)
|
|
125
|
+
except:
|
|
126
|
+
pass
|
|
127
|
+
self._remove_stale_lock()
|
|
81
128
|
|
|
82
129
|
def is_server_alive(self) -> bool:
|
|
83
130
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pmxt-1.0.3 → pmxt-1.0.4}/generated/pmxt_internal/models/search_markets_request_args_inner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|