pmxt 1.0.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.
- pmxt/__init__.py +58 -0
- pmxt/client.py +713 -0
- pmxt/models.py +296 -0
- pmxt/server_manager.py +242 -0
- pmxt-1.0.0.dist-info/METADATA +250 -0
- pmxt-1.0.0.dist-info/RECORD +56 -0
- pmxt-1.0.0.dist-info/WHEEL +5 -0
- pmxt-1.0.0.dist-info/top_level.txt +2 -0
- pmxt_internal/__init__.py +124 -0
- pmxt_internal/api/__init__.py +5 -0
- pmxt_internal/api/default_api.py +3722 -0
- pmxt_internal/api_client.py +804 -0
- pmxt_internal/api_response.py +21 -0
- pmxt_internal/configuration.py +578 -0
- pmxt_internal/exceptions.py +219 -0
- pmxt_internal/models/__init__.py +54 -0
- pmxt_internal/models/balance.py +93 -0
- pmxt_internal/models/base_request.py +91 -0
- pmxt_internal/models/base_response.py +93 -0
- pmxt_internal/models/cancel_order_request.py +94 -0
- pmxt_internal/models/create_order200_response.py +99 -0
- pmxt_internal/models/create_order_params.py +111 -0
- pmxt_internal/models/create_order_request.py +102 -0
- pmxt_internal/models/error_detail.py +87 -0
- pmxt_internal/models/error_response.py +93 -0
- pmxt_internal/models/exchange_credentials.py +93 -0
- pmxt_internal/models/fetch_balance200_response.py +103 -0
- pmxt_internal/models/fetch_markets200_response.py +103 -0
- pmxt_internal/models/fetch_markets_request.py +102 -0
- pmxt_internal/models/fetch_ohlcv200_response.py +103 -0
- pmxt_internal/models/fetch_ohlcv_request.py +102 -0
- pmxt_internal/models/fetch_ohlcv_request_args_inner.py +140 -0
- pmxt_internal/models/fetch_open_orders200_response.py +103 -0
- pmxt_internal/models/fetch_open_orders_request.py +94 -0
- pmxt_internal/models/fetch_order_book200_response.py +99 -0
- pmxt_internal/models/fetch_order_book_request.py +94 -0
- pmxt_internal/models/fetch_positions200_response.py +103 -0
- pmxt_internal/models/fetch_positions_request.py +94 -0
- pmxt_internal/models/fetch_trades200_response.py +103 -0
- pmxt_internal/models/fetch_trades_request.py +102 -0
- pmxt_internal/models/get_markets_by_slug_request.py +94 -0
- pmxt_internal/models/health_check200_response.py +89 -0
- pmxt_internal/models/history_filter_params.py +101 -0
- pmxt_internal/models/market_filter_params.py +113 -0
- pmxt_internal/models/market_outcome.py +95 -0
- pmxt_internal/models/order.py +139 -0
- pmxt_internal/models/order_book.py +106 -0
- pmxt_internal/models/order_level.py +89 -0
- pmxt_internal/models/position.py +101 -0
- pmxt_internal/models/price_candle.py +97 -0
- pmxt_internal/models/search_markets_request.py +102 -0
- pmxt_internal/models/search_markets_request_args_inner.py +140 -0
- pmxt_internal/models/trade.py +105 -0
- pmxt_internal/models/unified_market.py +120 -0
- pmxt_internal/py.typed +0 -0
- pmxt_internal/rest.py +263 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PMXT Sidecar API
|
|
5
|
+
|
|
6
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
from typing_extensions import Self
|
|
16
|
+
|
|
17
|
+
class OpenApiException(Exception):
|
|
18
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
22
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
|
23
|
+
key_type=None) -> None:
|
|
24
|
+
""" Raises an exception for TypeErrors
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
msg (str): the exception message
|
|
28
|
+
|
|
29
|
+
Keyword Args:
|
|
30
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
31
|
+
current_item
|
|
32
|
+
None if unset
|
|
33
|
+
valid_classes (tuple): the primitive classes that current item
|
|
34
|
+
should be an instance of
|
|
35
|
+
None if unset
|
|
36
|
+
key_type (bool): False if our value is a value in a dict
|
|
37
|
+
True if it is a key in a dict
|
|
38
|
+
False if our item is an item in a list
|
|
39
|
+
None if unset
|
|
40
|
+
"""
|
|
41
|
+
self.path_to_item = path_to_item
|
|
42
|
+
self.valid_classes = valid_classes
|
|
43
|
+
self.key_type = key_type
|
|
44
|
+
full_msg = msg
|
|
45
|
+
if path_to_item:
|
|
46
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
47
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
51
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
52
|
+
"""
|
|
53
|
+
Args:
|
|
54
|
+
msg (str): the exception message
|
|
55
|
+
|
|
56
|
+
Keyword Args:
|
|
57
|
+
path_to_item (list) the path to the exception in the
|
|
58
|
+
received_data dict. None if unset
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
self.path_to_item = path_to_item
|
|
62
|
+
full_msg = msg
|
|
63
|
+
if path_to_item:
|
|
64
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
65
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
69
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
70
|
+
"""
|
|
71
|
+
Raised when an attribute reference or assignment fails.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
msg (str): the exception message
|
|
75
|
+
|
|
76
|
+
Keyword Args:
|
|
77
|
+
path_to_item (None/list) the path to the exception in the
|
|
78
|
+
received_data dict
|
|
79
|
+
"""
|
|
80
|
+
self.path_to_item = path_to_item
|
|
81
|
+
full_msg = msg
|
|
82
|
+
if path_to_item:
|
|
83
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
84
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
88
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
89
|
+
"""
|
|
90
|
+
Args:
|
|
91
|
+
msg (str): the exception message
|
|
92
|
+
|
|
93
|
+
Keyword Args:
|
|
94
|
+
path_to_item (None/list) the path to the exception in the
|
|
95
|
+
received_data dict
|
|
96
|
+
"""
|
|
97
|
+
self.path_to_item = path_to_item
|
|
98
|
+
full_msg = msg
|
|
99
|
+
if path_to_item:
|
|
100
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
101
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class ApiException(OpenApiException):
|
|
105
|
+
|
|
106
|
+
def __init__(
|
|
107
|
+
self,
|
|
108
|
+
status=None,
|
|
109
|
+
reason=None,
|
|
110
|
+
http_resp=None,
|
|
111
|
+
*,
|
|
112
|
+
body: Optional[str] = None,
|
|
113
|
+
data: Optional[Any] = None,
|
|
114
|
+
) -> None:
|
|
115
|
+
self.status = status
|
|
116
|
+
self.reason = reason
|
|
117
|
+
self.body = body
|
|
118
|
+
self.data = data
|
|
119
|
+
self.headers = None
|
|
120
|
+
|
|
121
|
+
if http_resp:
|
|
122
|
+
if self.status is None:
|
|
123
|
+
self.status = http_resp.status
|
|
124
|
+
if self.reason is None:
|
|
125
|
+
self.reason = http_resp.reason
|
|
126
|
+
if self.body is None:
|
|
127
|
+
try:
|
|
128
|
+
self.body = http_resp.data.decode('utf-8')
|
|
129
|
+
except Exception:
|
|
130
|
+
pass
|
|
131
|
+
self.headers = http_resp.headers
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_response(
|
|
135
|
+
cls,
|
|
136
|
+
*,
|
|
137
|
+
http_resp,
|
|
138
|
+
body: Optional[str],
|
|
139
|
+
data: Optional[Any],
|
|
140
|
+
) -> Self:
|
|
141
|
+
if http_resp.status == 400:
|
|
142
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
143
|
+
|
|
144
|
+
if http_resp.status == 401:
|
|
145
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
146
|
+
|
|
147
|
+
if http_resp.status == 403:
|
|
148
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
149
|
+
|
|
150
|
+
if http_resp.status == 404:
|
|
151
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
152
|
+
|
|
153
|
+
# Added new conditions for 409 and 422
|
|
154
|
+
if http_resp.status == 409:
|
|
155
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
156
|
+
|
|
157
|
+
if http_resp.status == 422:
|
|
158
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
159
|
+
|
|
160
|
+
if 500 <= http_resp.status <= 599:
|
|
161
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
162
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
163
|
+
|
|
164
|
+
def __str__(self):
|
|
165
|
+
"""Custom error messages for exception"""
|
|
166
|
+
error_message = "({0})\n"\
|
|
167
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
168
|
+
if self.headers:
|
|
169
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
170
|
+
self.headers)
|
|
171
|
+
|
|
172
|
+
if self.body:
|
|
173
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
174
|
+
|
|
175
|
+
if self.data:
|
|
176
|
+
error_message += "HTTP response data: {0}\n".format(self.data)
|
|
177
|
+
|
|
178
|
+
return error_message
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class BadRequestException(ApiException):
|
|
182
|
+
pass
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class NotFoundException(ApiException):
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class UnauthorizedException(ApiException):
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class ForbiddenException(ApiException):
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class ServiceException(ApiException):
|
|
198
|
+
pass
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class ConflictException(ApiException):
|
|
202
|
+
"""Exception for HTTP 409 Conflict."""
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class UnprocessableEntityException(ApiException):
|
|
207
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
208
|
+
pass
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def render_path(path_to_item):
|
|
212
|
+
"""Returns a string representation of a path"""
|
|
213
|
+
result = ""
|
|
214
|
+
for pth in path_to_item:
|
|
215
|
+
if isinstance(pth, int):
|
|
216
|
+
result += "[{0}]".format(pth)
|
|
217
|
+
else:
|
|
218
|
+
result += "['{0}']".format(pth)
|
|
219
|
+
return result
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
PMXT Sidecar API
|
|
6
|
+
|
|
7
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
8
|
+
|
|
9
|
+
The version of the OpenAPI document: 0.4.4
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
# import models into model package
|
|
16
|
+
from pmxt_internal.models.balance import Balance
|
|
17
|
+
from pmxt_internal.models.base_request import BaseRequest
|
|
18
|
+
from pmxt_internal.models.base_response import BaseResponse
|
|
19
|
+
from pmxt_internal.models.cancel_order_request import CancelOrderRequest
|
|
20
|
+
from pmxt_internal.models.create_order200_response import CreateOrder200Response
|
|
21
|
+
from pmxt_internal.models.create_order_params import CreateOrderParams
|
|
22
|
+
from pmxt_internal.models.create_order_request import CreateOrderRequest
|
|
23
|
+
from pmxt_internal.models.error_detail import ErrorDetail
|
|
24
|
+
from pmxt_internal.models.error_response import ErrorResponse
|
|
25
|
+
from pmxt_internal.models.exchange_credentials import ExchangeCredentials
|
|
26
|
+
from pmxt_internal.models.fetch_balance200_response import FetchBalance200Response
|
|
27
|
+
from pmxt_internal.models.fetch_markets200_response import FetchMarkets200Response
|
|
28
|
+
from pmxt_internal.models.fetch_markets_request import FetchMarketsRequest
|
|
29
|
+
from pmxt_internal.models.fetch_ohlcv200_response import FetchOHLCV200Response
|
|
30
|
+
from pmxt_internal.models.fetch_ohlcv_request import FetchOHLCVRequest
|
|
31
|
+
from pmxt_internal.models.fetch_ohlcv_request_args_inner import FetchOHLCVRequestArgsInner
|
|
32
|
+
from pmxt_internal.models.fetch_open_orders200_response import FetchOpenOrders200Response
|
|
33
|
+
from pmxt_internal.models.fetch_open_orders_request import FetchOpenOrdersRequest
|
|
34
|
+
from pmxt_internal.models.fetch_order_book200_response import FetchOrderBook200Response
|
|
35
|
+
from pmxt_internal.models.fetch_order_book_request import FetchOrderBookRequest
|
|
36
|
+
from pmxt_internal.models.fetch_positions200_response import FetchPositions200Response
|
|
37
|
+
from pmxt_internal.models.fetch_positions_request import FetchPositionsRequest
|
|
38
|
+
from pmxt_internal.models.fetch_trades200_response import FetchTrades200Response
|
|
39
|
+
from pmxt_internal.models.fetch_trades_request import FetchTradesRequest
|
|
40
|
+
from pmxt_internal.models.get_markets_by_slug_request import GetMarketsBySlugRequest
|
|
41
|
+
from pmxt_internal.models.health_check200_response import HealthCheck200Response
|
|
42
|
+
from pmxt_internal.models.history_filter_params import HistoryFilterParams
|
|
43
|
+
from pmxt_internal.models.market_filter_params import MarketFilterParams
|
|
44
|
+
from pmxt_internal.models.market_outcome import MarketOutcome
|
|
45
|
+
from pmxt_internal.models.order import Order
|
|
46
|
+
from pmxt_internal.models.order_book import OrderBook
|
|
47
|
+
from pmxt_internal.models.order_level import OrderLevel
|
|
48
|
+
from pmxt_internal.models.position import Position
|
|
49
|
+
from pmxt_internal.models.price_candle import PriceCandle
|
|
50
|
+
from pmxt_internal.models.search_markets_request import SearchMarketsRequest
|
|
51
|
+
from pmxt_internal.models.search_markets_request_args_inner import SearchMarketsRequestArgsInner
|
|
52
|
+
from pmxt_internal.models.trade import Trade
|
|
53
|
+
from pmxt_internal.models.unified_market import UnifiedMarket
|
|
54
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PMXT Sidecar API
|
|
5
|
+
|
|
6
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class Balance(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Balance
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
currency: Optional[StrictStr] = None
|
|
30
|
+
total: Optional[Union[StrictFloat, StrictInt]] = None
|
|
31
|
+
available: Optional[Union[StrictFloat, StrictInt]] = None
|
|
32
|
+
locked: Optional[Union[StrictFloat, StrictInt]] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["currency", "total", "available", "locked"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of Balance from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of Balance from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"currency": obj.get("currency"),
|
|
87
|
+
"total": obj.get("total"),
|
|
88
|
+
"available": obj.get("available"),
|
|
89
|
+
"locked": obj.get("locked")
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PMXT Sidecar API
|
|
5
|
+
|
|
6
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from pmxt_internal.models.exchange_credentials import ExchangeCredentials
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class BaseRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Base request structure with optional credentials
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
credentials: Optional[ExchangeCredentials] = None
|
|
31
|
+
__properties: ClassVar[List[str]] = ["credentials"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of BaseRequest from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of credentials
|
|
73
|
+
if self.credentials:
|
|
74
|
+
_dict['credentials'] = self.credentials.to_dict()
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of BaseRequest from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PMXT Sidecar API
|
|
5
|
+
|
|
6
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictBool
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from pmxt_internal.models.error_detail import ErrorDetail
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class BaseResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
BaseResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
success: Optional[StrictBool] = None
|
|
31
|
+
error: Optional[ErrorDetail] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["success", "error"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of BaseResponse from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of error
|
|
74
|
+
if self.error:
|
|
75
|
+
_dict['error'] = self.error.to_dict()
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of BaseResponse from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"success": obj.get("success"),
|
|
89
|
+
"error": ErrorDetail.from_dict(obj["error"]) if obj.get("error") is not None else None
|
|
90
|
+
})
|
|
91
|
+
return _obj
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PMXT Sidecar API
|
|
5
|
+
|
|
6
|
+
A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.4
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from pmxt_internal.models.exchange_credentials import ExchangeCredentials
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class CancelOrderRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
CancelOrderRequest
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
args: Annotated[List[StrictStr], Field(min_length=1, max_length=1)]
|
|
32
|
+
credentials: Optional[ExchangeCredentials] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["args", "credentials"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of CancelOrderRequest from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of credentials
|
|
75
|
+
if self.credentials:
|
|
76
|
+
_dict['credentials'] = self.credentials.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of CancelOrderRequest from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"args": obj.get("args"),
|
|
90
|
+
"credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|