pmxt 1.0.0b2__py3-none-any.whl → 1.0.0b3__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/client.py CHANGED
@@ -201,6 +201,18 @@ class Exchange(ABC):
201
201
  raise Exception(error.get("message", "Unknown error"))
202
202
  return response.get("data")
203
203
 
204
+ def _get_credentials_dict(self) -> Optional[Dict[str, Any]]:
205
+ """Build credentials dictionary for API requests."""
206
+ if not self.api_key and not self.private_key:
207
+ return None
208
+
209
+ creds = {}
210
+ if self.api_key:
211
+ creds["apiKey"] = self.api_key
212
+ if self.private_key:
213
+ creds["privateKey"] = self.private_key
214
+ return creds if creds else None
215
+
204
216
  # Market Data Methods
205
217
 
206
218
  def fetch_markets(self, params: Optional[MarketFilterParams] = None) -> List[UnifiedMarket]:
@@ -221,6 +233,11 @@ class Exchange(ABC):
221
233
  if params:
222
234
  body_dict["args"] = [params.__dict__]
223
235
 
236
+ # Add credentials if available
237
+ creds = self._get_credentials_dict()
238
+ if creds:
239
+ body_dict["credentials"] = creds
240
+
224
241
  request_body = internal_models.FetchMarketsRequest.from_dict(body_dict)
225
242
 
226
243
  response = self._api.fetch_markets(
@@ -447,6 +464,12 @@ class Exchange(ABC):
447
464
  params_dict["price"] = params.price
448
465
 
449
466
  request_body_dict = {"args": [params_dict]}
467
+
468
+ # Add credentials if available
469
+ creds = self._get_credentials_dict()
470
+ if creds:
471
+ request_body_dict["credentials"] = creds
472
+
450
473
  request_body = internal_models.CreateOrderRequest.from_dict(request_body_dict)
451
474
 
452
475
  response = self._api.create_order(
@@ -471,6 +494,12 @@ class Exchange(ABC):
471
494
  """
472
495
  try:
473
496
  body_dict = {"args": [order_id]}
497
+
498
+ # Add credentials if available
499
+ creds = self._get_credentials_dict()
500
+ if creds:
501
+ body_dict["credentials"] = creds
502
+
474
503
  request_body = internal_models.CancelOrderRequest.from_dict(body_dict)
475
504
 
476
505
  response = self._api.cancel_order(
@@ -495,6 +524,12 @@ class Exchange(ABC):
495
524
  """
496
525
  try:
497
526
  body_dict = {"args": [order_id]}
527
+
528
+ # Add credentials if available
529
+ creds = self._get_credentials_dict()
530
+ if creds:
531
+ body_dict["credentials"] = creds
532
+
498
533
  request_body = internal_models.FetchOrderRequest.from_dict(body_dict)
499
534
 
500
535
  response = self._api.fetch_order(
@@ -523,6 +558,12 @@ class Exchange(ABC):
523
558
  args.append(market_id)
524
559
 
525
560
  body_dict = {"args": args}
561
+
562
+ # Add credentials if available
563
+ creds = self._get_credentials_dict()
564
+ if creds:
565
+ body_dict["credentials"] = creds
566
+
526
567
  request_body = internal_models.FetchOpenOrdersRequest.from_dict(body_dict)
527
568
 
528
569
  response = self._api.fetch_open_orders(
@@ -546,6 +587,12 @@ class Exchange(ABC):
546
587
  """
547
588
  try:
548
589
  body_dict = {"args": []}
590
+
591
+ # Add credentials if available
592
+ creds = self._get_credentials_dict()
593
+ if creds:
594
+ body_dict["credentials"] = creds
595
+
549
596
  request_body = internal_models.FetchPositionsRequest.from_dict(body_dict)
550
597
 
551
598
  response = self._api.fetch_positions(
@@ -567,6 +614,12 @@ class Exchange(ABC):
567
614
  """
568
615
  try:
569
616
  body_dict = {"args": []}
617
+
618
+ # Add credentials if available
619
+ creds = self._get_credentials_dict()
620
+ if creds:
621
+ body_dict["credentials"] = creds
622
+
570
623
  # Note: Generator name for this request might be reused from FetchPositionsRequest
571
624
  # if the schemas are identical (empty args array)
572
625
  request_body = internal_models.FetchPositionsRequest.from_dict(body_dict)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pmxt
3
- Version: 1.0.0b2
3
+ Version: 1.0.0b3
4
4
  Summary: Unified prediction market data API - The ccxt for prediction markets
5
5
  Author: PMXT Contributors
6
6
  License: MIT
@@ -1,40 +1,42 @@
1
1
  pmxt/__init__.py,sha256=4NsyNOxwK1CBhxuFiJwpIiLcGCAYgwKJuQ7bTnsNaUs,1150
2
- pmxt/client.py,sha256=ZxImc2pYjvVGr51lmKGMj89ecRaNcBqoyvPqNIhUHLY,21420
2
+ pmxt/client.py,sha256=0UltGwG5_p96izSO7rhPnKM0rvIETW7jxrGc7vHsDRE,23163
3
3
  pmxt/models.py,sha256=Mu0hLVjQU3PM5m68poK61VQcJtPQ8ZdLdLU7pq1lqjQ,6004
4
4
  pmxt/server_manager.py,sha256=_RZ6bfTzmD4cnpsDcjgvoSEW_Ep6oCMHT6bGVpQNHdc,7812
5
- pmxt_internal/__init__.py,sha256=jYnW9iT1XipuXcWz00BmKs7Qm-mxWV6sg4jptw9emfU,5759
6
- pmxt_internal/api_client.py,sha256=d9e8FqK4ISRrA0O-7mnoHa_fwtTtW0XyQyE_XR7vSy8,27891
5
+ pmxt_internal/__init__.py,sha256=LADPF8i2RlPXCNUH-tVM7r0Vdh5_9O4mVa5982Guow8,5975
6
+ pmxt_internal/api_client.py,sha256=vKqQx5piG1oSiReyxIzVv4vOKDF1jpVE3lvSuQqk44g,27891
7
7
  pmxt_internal/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
8
- pmxt_internal/configuration.py,sha256=bLR7kUC9Gl0o2iIdeKUO1ohr6siU_x9BQ0CanPI59yo,18322
8
+ pmxt_internal/configuration.py,sha256=iIiHXdjS6Vv4DdpbrGL3tWY9P3zZ7n1FDORJJ8v2HJw,18322
9
9
  pmxt_internal/exceptions.py,sha256=txF8A7vlan57JS69kFPs-IZF-Qhp7IZobBTJVa4fOaM,6644
10
10
  pmxt_internal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  pmxt_internal/rest.py,sha256=FMj4yaV6XLr842u_ScWHSzQsTFdk0jaUeuWLJoRbogQ,9760
12
12
  pmxt_internal/api/__init__.py,sha256=ppJSCipQ5IAk2z6UZkFaGSsEmnoAnSSHb8sjb_DYUkY,101
13
13
  pmxt_internal/api/default_api.py,sha256=V_-PxsEbTL4atCQR1r7GbeFvhtsVdbf3TSbTRM--Pv8,147482
14
- pmxt_internal/models/__init__.py,sha256=_dIn0aS0MqCxYvGVRryYsUDO8B9-bRUm8m5k32mbTzQ,3064
14
+ pmxt_internal/models/__init__.py,sha256=KpXW3FEk-LTETIR0djQy7GX_NxGIElnIg_SzfHLmqAA,3196
15
15
  pmxt_internal/models/balance.py,sha256=Dj5kFiLrsXOZyyXTC18bPjWrgw7qdWnTgTSCmk_l6xk,2962
16
+ pmxt_internal/models/base_request.py,sha256=ZNipF7ycXFkQJ6j3QmB1TzA0UO3fB54AMPlAgIA3KOA,2987
16
17
  pmxt_internal/models/base_response.py,sha256=g-NG4Swxl3cg4-YOCPl65dUeHzOnA9S7ubTj8HOYZs0,2975
17
- pmxt_internal/models/cancel_order_request.py,sha256=aC3QvrkHQj1F-8WRRT-Ytj0ZAXmbv5paBqZ998ysGto,2693
18
+ pmxt_internal/models/cancel_order_request.py,sha256=Q_tKEneDlyD9ZsqCifr4No9coPmzUWAiSnJFH2BhL5k,3153
18
19
  pmxt_internal/models/create_order200_response.py,sha256=f4urlJUUhTCOON-alIg9Ac_q3ymHqHyP_BNtDB0pyh4,3345
19
20
  pmxt_internal/models/create_order_params.py,sha256=byTxIMNeABia2D7j0UBPnr5qWPxq-kSI-wWJzOTRGvA,3638
20
- pmxt_internal/models/create_order_request.py,sha256=oGQOWPMyVO_V_QMEKsqaanJ55NfA_ple00GItloWpTA,3156
21
+ pmxt_internal/models/create_order_request.py,sha256=prj6TnIFbhB8eDq-6e-MK2DtfDzAB6P-SoEEEST0cP8,3616
21
22
  pmxt_internal/models/error_detail.py,sha256=590jlnQmIgqcjUQ5ef07_nWMn7fnyjuAvkUjmSoAkMs,2605
22
23
  pmxt_internal/models/error_response.py,sha256=c5DgOpTGqx9Qoz7hYKhRPAM3UfoX4GBWkyhfxerMXEI,2979
24
+ pmxt_internal/models/exchange_credentials.py,sha256=BtZCkGnnGQ24KPolTRtoA_jtXp-5_1Y1FmQLe1L5WCo,3308
23
25
  pmxt_internal/models/fetch_balance200_response.py,sha256=VN5yrsVSKnI_WprK1U4wbl60jGEiSnu4VAOGkSM5K4o,3539
24
26
  pmxt_internal/models/fetch_markets200_response.py,sha256=olOMs8IBKPL2Foqw3r66jeGcRlJpOpGcGq0jNccUPuA,3564
25
- pmxt_internal/models/fetch_markets_request.py,sha256=8A1RSLRN6yzbtzrLDRCQYdl77GuExMbw31o2sTyH8V4,3177
27
+ pmxt_internal/models/fetch_markets_request.py,sha256=2kV2N3jVPy7qKMpVMt-QiTP_Ea0Unrkq2R-qBnB5xKk,3627
26
28
  pmxt_internal/models/fetch_ohlcv200_response.py,sha256=npA7ztIBkBOIzxEX7M78eiQG03Ffb9Oko3DCw-SNLLo,3548
27
- pmxt_internal/models/fetch_ohlcv_request.py,sha256=_QhhfzA0OkW89eZTKadx4ib8tdDeozk0jiKH8rMVwzo,3226
29
+ pmxt_internal/models/fetch_ohlcv_request.py,sha256=-pEeahFvLwUCYka6kSdEx81ulczmPIR5UDTMRnHC9jU,3686
28
30
  pmxt_internal/models/fetch_ohlcv_request_args_inner.py,sha256=dmLOEq1cJWaIPYhik2k0urJ5-6mq5BW5uSiYTfcNQGY,5554
29
31
  pmxt_internal/models/fetch_open_orders200_response.py,sha256=LuEsylHrv7T8YcywHZFimOxUTzlHS9USSJry_ak5D3k,3543
30
- pmxt_internal/models/fetch_open_orders_request.py,sha256=QAZ9hsyYNorEXqr3dF333fpxqJNJ5dLTBTRFBXQzAYY,2722
32
+ pmxt_internal/models/fetch_open_orders_request.py,sha256=RaE_WcwWR5EuumNQCgJYrqr2GRBYU33yjCnyJULextY,3172
31
33
  pmxt_internal/models/fetch_order_book200_response.py,sha256=u9In7XRD0ImGC0gqVEYLGDFBRE5tkCrU3WH2lZtcJvA,3374
32
- pmxt_internal/models/fetch_order_book_request.py,sha256=Pnoxw4mzrjKJ--fA0dFRbtc5oWoC0neSPIzmSqiTx30,2705
34
+ pmxt_internal/models/fetch_order_book_request.py,sha256=nDVf8SdXUwxwTd8-PUXvhJwObHNDzoGNt0Oq04XB5nU,3165
33
35
  pmxt_internal/models/fetch_positions200_response.py,sha256=mzEq-rEYJaZHmjqjcaW9wwT0oIwakLFp3uWpPXJEc5k,3551
34
- pmxt_internal/models/fetch_positions_request.py,sha256=edTRsiJoLyk9iy_bDgqj7WPV8yHYHEHo9cyDIwQlPJg,2758
36
+ pmxt_internal/models/fetch_positions_request.py,sha256=F823DuKhltLMw04QrtSi1ZNVhkSISKz72evpWaEIaE8,3208
35
37
  pmxt_internal/models/fetch_trades200_response.py,sha256=fdsEd4luXJpzk6MuM192PaZ62fOBA3He3VreZhCd4-w,3527
36
- pmxt_internal/models/fetch_trades_request.py,sha256=xYFgzoaBT_n6Kix0t67_wAHOCRhhF5WQGMnOoo9A5pI,3230
37
- pmxt_internal/models/get_markets_by_slug_request.py,sha256=PyeDs43LUcak-yE_pIsOVJtaQmWAYa24Sf3e0RIT5Go,2713
38
+ pmxt_internal/models/fetch_trades_request.py,sha256=GQZGh2dy-Y3n8DnR8x5b9bLH_nLmCmIJqjcTTNzcoSA,3690
39
+ pmxt_internal/models/get_markets_by_slug_request.py,sha256=PtjXAw6hixHuYzCvSGH1aka2rZrsHmT8ofXYSuuOh9k,3173
38
40
  pmxt_internal/models/health_check200_response.py,sha256=yR_OkIlTPztO0zFmpyWllSwyaEbI48RpumfmVVCJAyc,2758
39
41
  pmxt_internal/models/history_filter_params.py,sha256=0i9oQLwJsRWRyzPZuW467y_0ccKpc2_I6T2lgZCkHd4,3239
40
42
  pmxt_internal/models/market_filter_params.py,sha256=Jun3HbQP05HEXlht1bYCrqrlgbO0QjP6vCOKCHkZn-E,3638
@@ -44,11 +46,11 @@ pmxt_internal/models/order_book.py,sha256=ztncjWjVR9EZE1Ta7LgTcRN_1ygR4ghtSTJigT
44
46
  pmxt_internal/models/order_level.py,sha256=dMeuXlhBqe1kA-R1ysFjt77qJxx6ukrZHwO1y3hZ6EM,2735
45
47
  pmxt_internal/models/position.py,sha256=a2v8JudGks66xtSU_BILwnEhxqfTu1o01g-ShWHpkeA,3740
46
48
  pmxt_internal/models/price_candle.py,sha256=AebmNrnVl_JI0Vqy_IRoRh08qX9ZUdzzazKmnVTuyio,3151
47
- pmxt_internal/models/search_markets_request.py,sha256=7g1eR7aDrpWdsY-S-YHp-O42zJ-IJyndQZmNUOCFYG8,3254
49
+ pmxt_internal/models/search_markets_request.py,sha256=BARoy2GXgV7RQNIGck6UaOyQqf0NIJkyGGbFf2cfZKc,3714
48
50
  pmxt_internal/models/search_markets_request_args_inner.py,sha256=PkusFd_OxhUsItsBpluPJA11zg0sXXjbOK-lPmemvLs,5561
49
51
  pmxt_internal/models/trade.py,sha256=U6Fc18rbwILs9FmX8CSDYYL8dF6763l8QzeMQNRxQdo,3328
50
52
  pmxt_internal/models/unified_market.py,sha256=VJNgzAmW4XNnjdpoi6F6xD_kl8jHUSNlW0Vz-Faf9vA,3625
51
- pmxt-1.0.0b2.dist-info/METADATA,sha256=3FvaKGAw0_NM1a3fjRW9NG792l3MAXKx3oHzF3hKI3E,6302
52
- pmxt-1.0.0b2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
- pmxt-1.0.0b2.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
54
- pmxt-1.0.0b2.dist-info/RECORD,,
53
+ pmxt-1.0.0b3.dist-info/METADATA,sha256=FIodSVVCGi-4rKK2xyYlMl-f9uXJPhkZZZlVZzwDxSk,6302
54
+ pmxt-1.0.0b3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ pmxt-1.0.0b3.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
56
+ pmxt-1.0.0b3.dist-info/RECORD,,
pmxt_internal/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.0.0b2"
17
+ __version__ = "1.0.0b3"
18
18
 
19
19
  # Define package exports
20
20
  __all__ = [
@@ -29,6 +29,7 @@ __all__ = [
29
29
  "ApiAttributeError",
30
30
  "ApiException",
31
31
  "Balance",
32
+ "BaseRequest",
32
33
  "BaseResponse",
33
34
  "CancelOrderRequest",
34
35
  "CreateOrder200Response",
@@ -36,6 +37,7 @@ __all__ = [
36
37
  "CreateOrderRequest",
37
38
  "ErrorDetail",
38
39
  "ErrorResponse",
40
+ "ExchangeCredentials",
39
41
  "FetchBalance200Response",
40
42
  "FetchMarkets200Response",
41
43
  "FetchMarketsRequest",
@@ -82,6 +84,7 @@ from pmxt_internal.exceptions import ApiException as ApiException
82
84
 
83
85
  # import models into sdk package
84
86
  from pmxt_internal.models.balance import Balance as Balance
87
+ from pmxt_internal.models.base_request import BaseRequest as BaseRequest
85
88
  from pmxt_internal.models.base_response import BaseResponse as BaseResponse
86
89
  from pmxt_internal.models.cancel_order_request import CancelOrderRequest as CancelOrderRequest
87
90
  from pmxt_internal.models.create_order200_response import CreateOrder200Response as CreateOrder200Response
@@ -89,6 +92,7 @@ from pmxt_internal.models.create_order_params import CreateOrderParams as Create
89
92
  from pmxt_internal.models.create_order_request import CreateOrderRequest as CreateOrderRequest
90
93
  from pmxt_internal.models.error_detail import ErrorDetail as ErrorDetail
91
94
  from pmxt_internal.models.error_response import ErrorResponse as ErrorResponse
95
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials as ExchangeCredentials
92
96
  from pmxt_internal.models.fetch_balance200_response import FetchBalance200Response as FetchBalance200Response
93
97
  from pmxt_internal.models.fetch_markets200_response import FetchMarkets200Response as FetchMarkets200Response
94
98
  from pmxt_internal.models.fetch_markets_request import FetchMarketsRequest as FetchMarketsRequest
@@ -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.0b2/python'
94
+ self.user_agent = 'OpenAPI-Generator/1.0.0b3/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.0b2".\
509
+ "SDK Package Version: 1.0.0b3".\
510
510
  format(env=sys.platform, pyversion=sys.version)
511
511
 
512
512
  def get_host_settings(self) -> List[HostSetting]:
@@ -14,6 +14,7 @@
14
14
 
15
15
  # import models into model package
16
16
  from pmxt_internal.models.balance import Balance
17
+ from pmxt_internal.models.base_request import BaseRequest
17
18
  from pmxt_internal.models.base_response import BaseResponse
18
19
  from pmxt_internal.models.cancel_order_request import CancelOrderRequest
19
20
  from pmxt_internal.models.create_order200_response import CreateOrder200Response
@@ -21,6 +22,7 @@ from pmxt_internal.models.create_order_params import CreateOrderParams
21
22
  from pmxt_internal.models.create_order_request import CreateOrderRequest
22
23
  from pmxt_internal.models.error_detail import ErrorDetail
23
24
  from pmxt_internal.models.error_response import ErrorResponse
25
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
24
26
  from pmxt_internal.models.fetch_balance200_response import FetchBalance200Response
25
27
  from pmxt_internal.models.fetch_markets200_response import FetchMarkets200Response
26
28
  from pmxt_internal.models.fetch_markets_request import FetchMarketsRequest
@@ -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
+
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
@@ -28,7 +29,8 @@ class CancelOrderRequest(BaseModel):
28
29
  CancelOrderRequest
29
30
  """ # noqa: E501
30
31
  args: Annotated[List[StrictStr], Field(min_length=1, max_length=1)]
31
- __properties: ClassVar[List[str]] = ["args"]
32
+ credentials: Optional[ExchangeCredentials] = None
33
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
32
34
 
33
35
  model_config = ConfigDict(
34
36
  populate_by_name=True,
@@ -69,6 +71,9 @@ class CancelOrderRequest(BaseModel):
69
71
  exclude=excluded_fields,
70
72
  exclude_none=True,
71
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()
72
77
  return _dict
73
78
 
74
79
  @classmethod
@@ -81,7 +86,8 @@ class CancelOrderRequest(BaseModel):
81
86
  return cls.model_validate(obj)
82
87
 
83
88
  _obj = cls.model_validate({
84
- "args": obj.get("args")
89
+ "args": obj.get("args"),
90
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
85
91
  })
86
92
  return _obj
87
93
 
@@ -18,9 +18,10 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
23
  from pmxt_internal.models.create_order_params import CreateOrderParams
24
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
26
27
 
@@ -29,7 +30,8 @@ class CreateOrderRequest(BaseModel):
29
30
  CreateOrderRequest
30
31
  """ # noqa: E501
31
32
  args: Annotated[List[CreateOrderParams], Field(min_length=1, max_length=1)]
32
- __properties: ClassVar[List[str]] = ["args"]
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
33
35
 
34
36
  model_config = ConfigDict(
35
37
  populate_by_name=True,
@@ -77,6 +79,9 @@ class CreateOrderRequest(BaseModel):
77
79
  if _item_args:
78
80
  _items.append(_item_args.to_dict())
79
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()
80
85
  return _dict
81
86
 
82
87
  @classmethod
@@ -89,7 +94,8 @@ class CreateOrderRequest(BaseModel):
89
94
  return cls.model_validate(obj)
90
95
 
91
96
  _obj = cls.model_validate({
92
- "args": [CreateOrderParams.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None
97
+ "args": [CreateOrderParams.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
93
99
  })
94
100
  return _obj
95
101
 
@@ -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, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ExchangeCredentials(BaseModel):
26
+ """
27
+ Optional authentication credentials for exchange operations
28
+ """ # noqa: E501
29
+ api_key: Optional[StrictStr] = Field(default=None, description="API key for the exchange", alias="apiKey")
30
+ private_key: Optional[StrictStr] = Field(default=None, description="Private key for signing transactions", alias="privateKey")
31
+ api_secret: Optional[StrictStr] = Field(default=None, description="API secret (if required by exchange)", alias="apiSecret")
32
+ passphrase: Optional[StrictStr] = Field(default=None, description="Passphrase (if required by exchange)")
33
+ __properties: ClassVar[List[str]] = ["apiKey", "privateKey", "apiSecret", "passphrase"]
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 ExchangeCredentials 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 ExchangeCredentials 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
+ "apiKey": obj.get("apiKey"),
87
+ "privateKey": obj.get("privateKey"),
88
+ "apiSecret": obj.get("apiSecret"),
89
+ "passphrase": obj.get("passphrase")
90
+ })
91
+ return _obj
92
+
93
+
@@ -20,6 +20,7 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from pmxt_internal.models.market_filter_params import MarketFilterParams
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
@@ -29,7 +30,8 @@ class FetchMarketsRequest(BaseModel):
29
30
  FetchMarketsRequest
30
31
  """ # noqa: E501
31
32
  args: Optional[Annotated[List[MarketFilterParams], Field(max_length=1)]] = None
32
- __properties: ClassVar[List[str]] = ["args"]
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
33
35
 
34
36
  model_config = ConfigDict(
35
37
  populate_by_name=True,
@@ -77,6 +79,9 @@ class FetchMarketsRequest(BaseModel):
77
79
  if _item_args:
78
80
  _items.append(_item_args.to_dict())
79
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()
80
85
  return _dict
81
86
 
82
87
  @classmethod
@@ -89,7 +94,8 @@ class FetchMarketsRequest(BaseModel):
89
94
  return cls.model_validate(obj)
90
95
 
91
96
  _obj = cls.model_validate({
92
- "args": [MarketFilterParams.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None
97
+ "args": [MarketFilterParams.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
93
99
  })
94
100
  return _obj
95
101
 
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from pmxt_internal.models.fetch_ohlcv_request_args_inner import FetchOHLCVRequestArgsInner
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
@@ -29,7 +30,8 @@ class FetchOHLCVRequest(BaseModel):
29
30
  FetchOHLCVRequest
30
31
  """ # noqa: E501
31
32
  args: Annotated[List[FetchOHLCVRequestArgsInner], Field(min_length=2, max_length=2)] = Field(description="[id, params]")
32
- __properties: ClassVar[List[str]] = ["args"]
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
33
35
 
34
36
  model_config = ConfigDict(
35
37
  populate_by_name=True,
@@ -77,6 +79,9 @@ class FetchOHLCVRequest(BaseModel):
77
79
  if _item_args:
78
80
  _items.append(_item_args.to_dict())
79
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()
80
85
  return _dict
81
86
 
82
87
  @classmethod
@@ -89,7 +94,8 @@ class FetchOHLCVRequest(BaseModel):
89
94
  return cls.model_validate(obj)
90
95
 
91
96
  _obj = cls.model_validate({
92
- "args": [FetchOHLCVRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None
97
+ "args": [FetchOHLCVRequestArgsInner.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
93
99
  })
94
100
  return _obj
95
101
 
@@ -20,6 +20,7 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
@@ -28,7 +29,8 @@ class FetchOpenOrdersRequest(BaseModel):
28
29
  FetchOpenOrdersRequest
29
30
  """ # noqa: E501
30
31
  args: Optional[Annotated[List[StrictStr], Field(max_length=1)]] = None
31
- __properties: ClassVar[List[str]] = ["args"]
32
+ credentials: Optional[ExchangeCredentials] = None
33
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
32
34
 
33
35
  model_config = ConfigDict(
34
36
  populate_by_name=True,
@@ -69,6 +71,9 @@ class FetchOpenOrdersRequest(BaseModel):
69
71
  exclude=excluded_fields,
70
72
  exclude_none=True,
71
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()
72
77
  return _dict
73
78
 
74
79
  @classmethod
@@ -81,7 +86,8 @@ class FetchOpenOrdersRequest(BaseModel):
81
86
  return cls.model_validate(obj)
82
87
 
83
88
  _obj = cls.model_validate({
84
- "args": obj.get("args")
89
+ "args": obj.get("args"),
90
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
85
91
  })
86
92
  return _obj
87
93
 
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
@@ -28,7 +29,8 @@ class FetchOrderBookRequest(BaseModel):
28
29
  FetchOrderBookRequest
29
30
  """ # noqa: E501
30
31
  args: Annotated[List[StrictStr], Field(min_length=1, max_length=1)]
31
- __properties: ClassVar[List[str]] = ["args"]
32
+ credentials: Optional[ExchangeCredentials] = None
33
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
32
34
 
33
35
  model_config = ConfigDict(
34
36
  populate_by_name=True,
@@ -69,6 +71,9 @@ class FetchOrderBookRequest(BaseModel):
69
71
  exclude=excluded_fields,
70
72
  exclude_none=True,
71
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()
72
77
  return _dict
73
78
 
74
79
  @classmethod
@@ -81,7 +86,8 @@ class FetchOrderBookRequest(BaseModel):
81
86
  return cls.model_validate(obj)
82
87
 
83
88
  _obj = cls.model_validate({
84
- "args": obj.get("args")
89
+ "args": obj.get("args"),
90
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
85
91
  })
86
92
  return _obj
87
93
 
@@ -20,6 +20,7 @@ import json
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
@@ -28,7 +29,8 @@ class FetchPositionsRequest(BaseModel):
28
29
  FetchPositionsRequest
29
30
  """ # noqa: E501
30
31
  args: Optional[Annotated[List[Any], Field(max_length=0)]] = Field(default=None, description="Empty array (no arguments)")
31
- __properties: ClassVar[List[str]] = ["args"]
32
+ credentials: Optional[ExchangeCredentials] = None
33
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
32
34
 
33
35
  model_config = ConfigDict(
34
36
  populate_by_name=True,
@@ -69,6 +71,9 @@ class FetchPositionsRequest(BaseModel):
69
71
  exclude=excluded_fields,
70
72
  exclude_none=True,
71
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()
72
77
  return _dict
73
78
 
74
79
  @classmethod
@@ -81,7 +86,8 @@ class FetchPositionsRequest(BaseModel):
81
86
  return cls.model_validate(obj)
82
87
 
83
88
  _obj = cls.model_validate({
84
- "args": obj.get("args")
89
+ "args": obj.get("args"),
90
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
85
91
  })
86
92
  return _obj
87
93
 
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from pmxt_internal.models.fetch_ohlcv_request_args_inner import FetchOHLCVRequestArgsInner
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
@@ -29,7 +30,8 @@ class FetchTradesRequest(BaseModel):
29
30
  FetchTradesRequest
30
31
  """ # noqa: E501
31
32
  args: Annotated[List[FetchOHLCVRequestArgsInner], Field(min_length=2, max_length=2)] = Field(description="[id, params]")
32
- __properties: ClassVar[List[str]] = ["args"]
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
33
35
 
34
36
  model_config = ConfigDict(
35
37
  populate_by_name=True,
@@ -77,6 +79,9 @@ class FetchTradesRequest(BaseModel):
77
79
  if _item_args:
78
80
  _items.append(_item_args.to_dict())
79
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()
80
85
  return _dict
81
86
 
82
87
  @classmethod
@@ -89,7 +94,8 @@ class FetchTradesRequest(BaseModel):
89
94
  return cls.model_validate(obj)
90
95
 
91
96
  _obj = cls.model_validate({
92
- "args": [FetchOHLCVRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None
97
+ "args": [FetchOHLCVRequestArgsInner.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
93
99
  })
94
100
  return _obj
95
101
 
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
26
 
@@ -28,7 +29,8 @@ class GetMarketsBySlugRequest(BaseModel):
28
29
  GetMarketsBySlugRequest
29
30
  """ # noqa: E501
30
31
  args: Annotated[List[StrictStr], Field(min_length=1, max_length=1)]
31
- __properties: ClassVar[List[str]] = ["args"]
32
+ credentials: Optional[ExchangeCredentials] = None
33
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
32
34
 
33
35
  model_config = ConfigDict(
34
36
  populate_by_name=True,
@@ -69,6 +71,9 @@ class GetMarketsBySlugRequest(BaseModel):
69
71
  exclude=excluded_fields,
70
72
  exclude_none=True,
71
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()
72
77
  return _dict
73
78
 
74
79
  @classmethod
@@ -81,7 +86,8 @@ class GetMarketsBySlugRequest(BaseModel):
81
86
  return cls.model_validate(obj)
82
87
 
83
88
  _obj = cls.model_validate({
84
- "args": obj.get("args")
89
+ "args": obj.get("args"),
90
+ "credentials": ExchangeCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None
85
91
  })
86
92
  return _obj
87
93
 
@@ -18,8 +18,9 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
- from typing import Any, ClassVar, Dict, List
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
+ from pmxt_internal.models.exchange_credentials import ExchangeCredentials
23
24
  from pmxt_internal.models.search_markets_request_args_inner import SearchMarketsRequestArgsInner
24
25
  from typing import Optional, Set
25
26
  from typing_extensions import Self
@@ -29,7 +30,8 @@ class SearchMarketsRequest(BaseModel):
29
30
  SearchMarketsRequest
30
31
  """ # noqa: E501
31
32
  args: Annotated[List[SearchMarketsRequestArgsInner], Field(min_length=1, max_length=2)] = Field(description="[query, params?]")
32
- __properties: ClassVar[List[str]] = ["args"]
33
+ credentials: Optional[ExchangeCredentials] = None
34
+ __properties: ClassVar[List[str]] = ["args", "credentials"]
33
35
 
34
36
  model_config = ConfigDict(
35
37
  populate_by_name=True,
@@ -77,6 +79,9 @@ class SearchMarketsRequest(BaseModel):
77
79
  if _item_args:
78
80
  _items.append(_item_args.to_dict())
79
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()
80
85
  return _dict
81
86
 
82
87
  @classmethod
@@ -89,7 +94,8 @@ class SearchMarketsRequest(BaseModel):
89
94
  return cls.model_validate(obj)
90
95
 
91
96
  _obj = cls.model_validate({
92
- "args": [SearchMarketsRequestArgsInner.from_dict(_item) for _item in obj["args"]] if obj.get("args") is not None else None
97
+ "args": [SearchMarketsRequestArgsInner.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
93
99
  })
94
100
  return _obj
95
101
 
File without changes