pmxt 1.0.4__py3-none-any.whl → 1.1.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 +1 -1
- pmxt/_server/server/bundled.js +21927 -274
- pmxt/client.py +104 -0
- {pmxt-1.0.4.dist-info → pmxt-1.1.0.dist-info}/METADATA +4 -4
- {pmxt-1.0.4.dist-info → pmxt-1.1.0.dist-info}/RECORD +15 -12
- pmxt_internal/__init__.py +7 -1
- pmxt_internal/api/default_api.py +578 -0
- pmxt_internal/api_client.py +1 -1
- pmxt_internal/configuration.py +1 -1
- pmxt_internal/models/__init__.py +3 -0
- pmxt_internal/models/watch_order_book_request.py +102 -0
- pmxt_internal/models/watch_order_book_request_args_inner.py +143 -0
- pmxt_internal/models/watch_trades_request.py +102 -0
- {pmxt-1.0.4.dist-info → pmxt-1.1.0.dist-info}/WHEEL +0 -0
- {pmxt-1.0.4.dist-info → pmxt-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
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
|
|
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 pmxt_internal.models.watch_order_book_request_args_inner import WatchOrderBookRequestArgsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class WatchOrderBookRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
WatchOrderBookRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
args: Annotated[List[WatchOrderBookRequestArgsInner], Field(min_length=1, max_length=2)] = Field(description="[outcomeId, limit?]")
|
|
33
|
+
credentials: Optional[ExchangeCredentials] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["args", "credentials"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of WatchOrderBookRequest from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in args (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.args:
|
|
78
|
+
for _item_args in self.args:
|
|
79
|
+
if _item_args:
|
|
80
|
+
_items.append(_item_args.to_dict())
|
|
81
|
+
_dict['args'] = _items
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of credentials
|
|
83
|
+
if self.credentials:
|
|
84
|
+
_dict['credentials'] = self.credentials.to_dict()
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
89
|
+
"""Create an instance of WatchOrderBookRequest from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate({
|
|
97
|
+
"args": [WatchOrderBookRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None,
|
|
98
|
+
"credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,143 @@
|
|
|
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 json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from pydantic import StrictStr, Field
|
|
21
|
+
from typing import Union, List, Set, Optional, Dict
|
|
22
|
+
from typing_extensions import Literal, Self
|
|
23
|
+
|
|
24
|
+
WATCHORDERBOOKREQUESTARGSINNER_ONE_OF_SCHEMAS = ["int", "str"]
|
|
25
|
+
|
|
26
|
+
class WatchOrderBookRequestArgsInner(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
WatchOrderBookRequestArgsInner
|
|
29
|
+
"""
|
|
30
|
+
# data type: str
|
|
31
|
+
oneof_schema_1_validator: Optional[StrictStr] = None
|
|
32
|
+
# data type: int
|
|
33
|
+
oneof_schema_2_validator: Optional[StrictInt] = None
|
|
34
|
+
actual_instance: Optional[Union[int, str]] = None
|
|
35
|
+
one_of_schemas: Set[str] = { "int", "str" }
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
44
|
+
if args:
|
|
45
|
+
if len(args) > 1:
|
|
46
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
47
|
+
if kwargs:
|
|
48
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
49
|
+
super().__init__(actual_instance=args[0])
|
|
50
|
+
else:
|
|
51
|
+
super().__init__(**kwargs)
|
|
52
|
+
|
|
53
|
+
@field_validator('actual_instance')
|
|
54
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
55
|
+
instance = WatchOrderBookRequestArgsInner.model_construct()
|
|
56
|
+
error_messages = []
|
|
57
|
+
match = 0
|
|
58
|
+
# validate data type: str
|
|
59
|
+
try:
|
|
60
|
+
instance.oneof_schema_1_validator = v
|
|
61
|
+
match += 1
|
|
62
|
+
except (ValidationError, ValueError) as e:
|
|
63
|
+
error_messages.append(str(e))
|
|
64
|
+
# validate data type: int
|
|
65
|
+
try:
|
|
66
|
+
instance.oneof_schema_2_validator = v
|
|
67
|
+
match += 1
|
|
68
|
+
except (ValidationError, ValueError) as e:
|
|
69
|
+
error_messages.append(str(e))
|
|
70
|
+
if match > 1:
|
|
71
|
+
# more than 1 match
|
|
72
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in WatchOrderBookRequestArgsInner with oneOf schemas: int, str. Details: " + ", ".join(error_messages))
|
|
73
|
+
elif match == 0:
|
|
74
|
+
# no match
|
|
75
|
+
raise ValueError("No match found when setting `actual_instance` in WatchOrderBookRequestArgsInner with oneOf schemas: int, str. Details: " + ", ".join(error_messages))
|
|
76
|
+
else:
|
|
77
|
+
return v
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
81
|
+
return cls.from_json(json.dumps(obj))
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_json(cls, json_str: str) -> Self:
|
|
85
|
+
"""Returns the object represented by the json string"""
|
|
86
|
+
instance = cls.model_construct()
|
|
87
|
+
error_messages = []
|
|
88
|
+
match = 0
|
|
89
|
+
|
|
90
|
+
# deserialize data into str
|
|
91
|
+
try:
|
|
92
|
+
# validation
|
|
93
|
+
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
94
|
+
# assign value to actual_instance
|
|
95
|
+
instance.actual_instance = instance.oneof_schema_1_validator
|
|
96
|
+
match += 1
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into int
|
|
100
|
+
try:
|
|
101
|
+
# validation
|
|
102
|
+
instance.oneof_schema_2_validator = json.loads(json_str)
|
|
103
|
+
# assign value to actual_instance
|
|
104
|
+
instance.actual_instance = instance.oneof_schema_2_validator
|
|
105
|
+
match += 1
|
|
106
|
+
except (ValidationError, ValueError) as e:
|
|
107
|
+
error_messages.append(str(e))
|
|
108
|
+
|
|
109
|
+
if match > 1:
|
|
110
|
+
# more than 1 match
|
|
111
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into WatchOrderBookRequestArgsInner with oneOf schemas: int, str. Details: " + ", ".join(error_messages))
|
|
112
|
+
elif match == 0:
|
|
113
|
+
# no match
|
|
114
|
+
raise ValueError("No match found when deserializing the JSON string into WatchOrderBookRequestArgsInner with oneOf schemas: int, str. Details: " + ", ".join(error_messages))
|
|
115
|
+
else:
|
|
116
|
+
return instance
|
|
117
|
+
|
|
118
|
+
def to_json(self) -> str:
|
|
119
|
+
"""Returns the JSON representation of the actual instance"""
|
|
120
|
+
if self.actual_instance is None:
|
|
121
|
+
return "null"
|
|
122
|
+
|
|
123
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
124
|
+
return self.actual_instance.to_json()
|
|
125
|
+
else:
|
|
126
|
+
return json.dumps(self.actual_instance)
|
|
127
|
+
|
|
128
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
|
|
129
|
+
"""Returns the dict representation of the actual instance"""
|
|
130
|
+
if self.actual_instance is None:
|
|
131
|
+
return None
|
|
132
|
+
|
|
133
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
134
|
+
return self.actual_instance.to_dict()
|
|
135
|
+
else:
|
|
136
|
+
# primitive type
|
|
137
|
+
return self.actual_instance
|
|
138
|
+
|
|
139
|
+
def to_str(self) -> str:
|
|
140
|
+
"""Returns the string representation of the actual instance"""
|
|
141
|
+
return pprint.pformat(self.model_dump())
|
|
142
|
+
|
|
143
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
|
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 pmxt_internal.models.watch_order_book_request_args_inner import WatchOrderBookRequestArgsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class WatchTradesRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
WatchTradesRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
args: Annotated[List[WatchOrderBookRequestArgsInner], Field(min_length=1, max_length=3)] = Field(description="[outcomeId, since?, limit?]")
|
|
33
|
+
credentials: Optional[ExchangeCredentials] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["args", "credentials"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of WatchTradesRequest from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in args (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.args:
|
|
78
|
+
for _item_args in self.args:
|
|
79
|
+
if _item_args:
|
|
80
|
+
_items.append(_item_args.to_dict())
|
|
81
|
+
_dict['args'] = _items
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of credentials
|
|
83
|
+
if self.credentials:
|
|
84
|
+
_dict['credentials'] = self.credentials.to_dict()
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
89
|
+
"""Create an instance of WatchTradesRequest from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate({
|
|
97
|
+
"args": [WatchOrderBookRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None,
|
|
98
|
+
"credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
File without changes
|
|
File without changes
|