pmxt 1.1.4__py3-none-any.whl → 1.2.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 CHANGED
@@ -33,7 +33,7 @@ from .models import (
33
33
  CreateOrderParams,
34
34
  )
35
35
 
36
- __version__ = "1.1.4"
36
+ __version__ = "1.2.0"
37
37
  __all__ = [
38
38
  # Exchanges
39
39
  "Polymarket",
pmxt/client.py CHANGED
@@ -38,18 +38,20 @@ from .models import (
38
38
  from .server_manager import ServerManager
39
39
 
40
40
 
41
+ def _convert_outcome(raw: Dict[str, Any]) -> MarketOutcome:
42
+ """Convert raw API response to MarketOutcome."""
43
+ return MarketOutcome(
44
+ id=raw.get("id"),
45
+ label=raw.get("label"),
46
+ price=raw.get("price"),
47
+ price_change_24h=raw.get("priceChange24h"),
48
+ metadata=raw.get("metadata"),
49
+ )
50
+
51
+
41
52
  def _convert_market(raw: Dict[str, Any]) -> UnifiedMarket:
42
53
  """Convert raw API response to UnifiedMarket."""
43
- outcomes = [
44
- MarketOutcome(
45
- id=o.get("id"),
46
- label=o.get("label"),
47
- price=o.get("price"),
48
- price_change_24h=o.get("priceChange24h"),
49
- metadata=o.get("metadata"),
50
- )
51
- for o in raw.get("outcomes", [])
52
- ]
54
+ outcomes = [_convert_outcome(o) for o in raw.get("outcomes", [])]
53
55
 
54
56
  return UnifiedMarket(
55
57
  id=raw.get("id"),
@@ -65,6 +67,10 @@ def _convert_market(raw: Dict[str, Any]) -> UnifiedMarket:
65
67
  image=raw.get("image"),
66
68
  category=raw.get("category"),
67
69
  tags=raw.get("tags"),
70
+ yes=_convert_outcome(raw["yes"]) if raw.get("yes") else None,
71
+ no=_convert_outcome(raw["no"]) if raw.get("no") else None,
72
+ up=_convert_outcome(raw["up"]) if raw.get("up") else None,
73
+ down=_convert_outcome(raw["down"]) if raw.get("down") else None,
68
74
  )
69
75
 
70
76
 
pmxt/models.py CHANGED
@@ -75,6 +75,18 @@ class UnifiedMarket:
75
75
  tags: Optional[List[str]] = None
76
76
  """Market tags"""
77
77
 
78
+ yes: Optional[MarketOutcome] = None
79
+ """Convenience access to the Yes outcome for binary markets."""
80
+
81
+ no: Optional[MarketOutcome] = None
82
+ """Convenience access to the No outcome for binary markets."""
83
+
84
+ up: Optional[MarketOutcome] = None
85
+ """Convenience access to the Up outcome for binary markets."""
86
+
87
+ down: Optional[MarketOutcome] = None
88
+ """Convenience access to the Down outcome for binary markets."""
89
+
78
90
 
79
91
  @dataclass
80
92
  class PriceCandle:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pmxt
3
- Version: 1.1.4
3
+ Version: 1.2.0
4
4
  Summary: Unified prediction market data API - The ccxt for prediction markets
5
5
  Author: PMXT Contributors
6
6
  License: MIT
@@ -1,14 +1,14 @@
1
- pmxt/__init__.py,sha256=nPnkJgn02N5WU8Vhoq-Or3qIb0Xtey3CMhxQgYucODY,1150
2
- pmxt/client.py,sha256=2qlCJsxkQiHYrYvZYX4p-APvYq0rF_yicNfUPgcE3ZU,27368
3
- pmxt/models.py,sha256=Mu0hLVjQU3PM5m68poK61VQcJtPQ8ZdLdLU7pq1lqjQ,6004
1
+ pmxt/__init__.py,sha256=j56wDMQ7UDMKuCfCG21_Yyu5sRfQZYAJr_O5KgazqAs,1150
2
+ pmxt/client.py,sha256=pTU7MYP_k0lj-0eJifbHVcpGQVn5U7MTTDisKbv3fVI,27755
3
+ pmxt/models.py,sha256=ZqRu__L8jnhZOYjE_Zy20dpft177Jb4lOZIkvBwuorg,6438
4
4
  pmxt/server_manager.py,sha256=-G97dYEdKl7F3HK9bAOKYl-SGWP6HsvzZIx2QxiZm24,11494
5
5
  pmxt/_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  pmxt/_server/bin/pmxt-ensure-server,sha256=kXIond0UbxS52FAVQD7kHmSBaL_s6cbIyapLRr4KZJw,4544
7
7
  pmxt/_server/server/bundled.js,sha256=bgJSNnbYAsY2opHDoF-EfnJZgD03Ws2FmKpWGGKcGYg,4187137
8
- pmxt_internal/__init__.py,sha256=Jd2A_VE8cEELJy5mWzDjFh29KLQp7WZtwW_D_zEymeo,6400
9
- pmxt_internal/api_client.py,sha256=VhIV8-ORzus9YZMeaBwITOFJ_GNHC3_A3QVBbJ1L8e4,27889
8
+ pmxt_internal/__init__.py,sha256=5scd_3UsIdcgcasF_lMtLRrmio0gNi-AqDefszhlCuE,6400
9
+ pmxt_internal/api_client.py,sha256=t5ZZ-asj3thoDVhqc0XqzS6XsVqtjYrCBnIBb_zMERw,27889
10
10
  pmxt_internal/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
11
- pmxt_internal/configuration.py,sha256=p-A9ZDqhrF7OGbr1sijqk8ZFyauKtBD-wbsESngqjTA,18320
11
+ pmxt_internal/configuration.py,sha256=mxljZIa_w0ecXcUnhWUSvlfp9ItsSAy7G2Srhmc4Ohg,18320
12
12
  pmxt_internal/exceptions.py,sha256=txF8A7vlan57JS69kFPs-IZF-Qhp7IZobBTJVa4fOaM,6644
13
13
  pmxt_internal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  pmxt_internal/rest.py,sha256=FMj4yaV6XLr842u_ScWHSzQsTFdk0jaUeuWLJoRbogQ,9760
@@ -52,11 +52,11 @@ pmxt_internal/models/price_candle.py,sha256=AebmNrnVl_JI0Vqy_IRoRh08qX9ZUdzzazKm
52
52
  pmxt_internal/models/search_markets_request.py,sha256=BARoy2GXgV7RQNIGck6UaOyQqf0NIJkyGGbFf2cfZKc,3714
53
53
  pmxt_internal/models/search_markets_request_args_inner.py,sha256=PkusFd_OxhUsItsBpluPJA11zg0sXXjbOK-lPmemvLs,5561
54
54
  pmxt_internal/models/trade.py,sha256=U6Fc18rbwILs9FmX8CSDYYL8dF6763l8QzeMQNRxQdo,3328
55
- pmxt_internal/models/unified_market.py,sha256=mNyUrGKWxvI2f2KCa2uhGwq22cBdDia2hD5AtzFw8fE,4487
55
+ pmxt_internal/models/unified_market.py,sha256=DoYhiH4HycYGlq858PEeB-CIA7haT6rxmJeYZJuulMA,5646
56
56
  pmxt_internal/models/watch_order_book_request.py,sha256=kavGUI-SLz2-Kam_jcJ_h0GDe0-9UkxqCmVsAi6Uios,3726
57
57
  pmxt_internal/models/watch_order_book_request_args_inner.py,sha256=ZHrjmFDGxRG5MXbuz4mUp9KFfo3XS7zuXWTyMNgi4xI,5464
58
58
  pmxt_internal/models/watch_trades_request.py,sha256=brrg8JbEe-aeg7mIe_Y2HzRPogp-IfRhkXChrxzqoLU,3722
59
- pmxt-1.1.4.dist-info/METADATA,sha256=l_QBz8aZvCOCv1CXu3BhOkWFN9mfZmiD2mF2P5SGlOY,6288
60
- pmxt-1.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
61
- pmxt-1.1.4.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
62
- pmxt-1.1.4.dist-info/RECORD,,
59
+ pmxt-1.2.0.dist-info/METADATA,sha256=r9aUUGW_AalVxZIHnLRDdyt40XIqBYl5XrYv1nE7oLA,6288
60
+ pmxt-1.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
61
+ pmxt-1.2.0.dist-info/top_level.txt,sha256=J_jrcouJ-x-5lpcXMxeW0GOSi1HsBVR5_PdSfvigVrw,19
62
+ pmxt-1.2.0.dist-info/RECORD,,
pmxt_internal/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
  """ # noqa: E501
15
15
 
16
16
 
17
- __version__ = "1.1.4"
17
+ __version__ = "1.2.0"
18
18
 
19
19
  # Define package exports
20
20
  __all__ = [
@@ -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.1.4/python'
94
+ self.user_agent = 'OpenAPI-Generator/1.2.0/python'
95
95
  self.client_side_validation = configuration.client_side_validation
96
96
 
97
97
  def __enter__(self):
@@ -506,7 +506,7 @@ class Configuration:
506
506
  "OS: {env}\n"\
507
507
  "Python Version: {pyversion}\n"\
508
508
  "Version of the API: 0.4.4\n"\
509
- "SDK Package Version: 1.1.4".\
509
+ "SDK Package Version: 1.2.0".\
510
510
  format(env=sys.platform, pyversion=sys.version)
511
511
 
512
512
  def get_host_settings(self) -> List[HostSetting]:
@@ -41,7 +41,11 @@ class UnifiedMarket(BaseModel):
41
41
  image: Optional[StrictStr] = None
42
42
  category: Optional[StrictStr] = None
43
43
  tags: Optional[List[StrictStr]] = None
44
- __properties: ClassVar[List[str]] = ["id", "title", "description", "outcomes", "resolutionDate", "volume24h", "volume", "liquidity", "openInterest", "url", "image", "category", "tags"]
44
+ yes: Optional[MarketOutcome] = None
45
+ no: Optional[MarketOutcome] = None
46
+ up: Optional[MarketOutcome] = None
47
+ down: Optional[MarketOutcome] = None
48
+ __properties: ClassVar[List[str]] = ["id", "title", "description", "outcomes", "resolutionDate", "volume24h", "volume", "liquidity", "openInterest", "url", "image", "category", "tags", "yes", "no", "up", "down"]
45
49
 
46
50
  model_config = ConfigDict(
47
51
  populate_by_name=True,
@@ -89,6 +93,18 @@ class UnifiedMarket(BaseModel):
89
93
  if _item_outcomes:
90
94
  _items.append(_item_outcomes.to_dict())
91
95
  _dict['outcomes'] = _items
96
+ # override the default output from pydantic by calling `to_dict()` of yes
97
+ if self.yes:
98
+ _dict['yes'] = self.yes.to_dict()
99
+ # override the default output from pydantic by calling `to_dict()` of no
100
+ if self.no:
101
+ _dict['no'] = self.no.to_dict()
102
+ # override the default output from pydantic by calling `to_dict()` of up
103
+ if self.up:
104
+ _dict['up'] = self.up.to_dict()
105
+ # override the default output from pydantic by calling `to_dict()` of down
106
+ if self.down:
107
+ _dict['down'] = self.down.to_dict()
92
108
  return _dict
93
109
 
94
110
  @classmethod
@@ -113,7 +129,11 @@ class UnifiedMarket(BaseModel):
113
129
  "url": obj.get("url"),
114
130
  "image": obj.get("image"),
115
131
  "category": obj.get("category"),
116
- "tags": obj.get("tags")
132
+ "tags": obj.get("tags"),
133
+ "yes": MarketOutcome.from_dict(obj["yes"]) if obj.get("yes") is not None else None,
134
+ "no": MarketOutcome.from_dict(obj["no"]) if obj.get("no") is not None else None,
135
+ "up": MarketOutcome.from_dict(obj["up"]) if obj.get("up") is not None else None,
136
+ "down": MarketOutcome.from_dict(obj["down"]) if obj.get("down") is not None else None
117
137
  })
118
138
  return _obj
119
139
 
File without changes