parlayx 3.2.4__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: parlayx
3
- Version: 3.2.4
3
+ Version: 3.3.0
4
4
  Summary: Official Python client for the ParlayX public API.
5
5
  Project-URL: Homepage, https://docs.parlayx.com
6
6
  Project-URL: Documentation, https://docs.parlayx.com
@@ -113,7 +113,7 @@ client.kalshi.submit_order(order, idempotency_key="my-retry-key")
113
113
 
114
114
  ### Errors
115
115
 
116
- Every non-2xx response raises `RequestError`, carrying a stable `code`, the HTTP `status`, a `message` and the parsed `body`:
116
+ Every non-2xx response raises `RequestError`, carrying a stable `code`, the HTTP `status`, a `message` and the parsed `body`. A 2xx response whose body this client version cannot parse raises `ResponseParseError`, a subclass of `RequestError`, with its 2xx `status`, `code` set to `None`, the parsed JSON in `body`, and the validation error chained as `__cause__`. The request's outcome is then unknown. On a write, some or all of it may have been applied: a batch or a scoped cancellation answers 2xx with an outcome per entry, any of which may have failed. Read the outcome back before acting on it, and never retry under a fresh `idempotency_key`, which would submit again whatever did apply. Upgrading the client usually resolves it.
117
117
 
118
118
  ```python
119
119
  from parlayx import ApiErrorCode, RequestError
@@ -139,6 +139,12 @@ except RequestError as error:
139
139
  balance = client.polymarket.get_balance()
140
140
  ```
141
141
 
142
+ ### Upgrading to 3.3.0
143
+
144
+ - Order ids the client returns are `uuid.UUID` values, and every method that takes an order id now accepts one directly, as well as a `str`.
145
+ - A 2xx response this version cannot parse now raises `ResponseParseError` instead of pydantic's `ValidationError`. It is a `RequestError` and a `ValueError`; the pydantic error is its `__cause__`. Code that caught `pydantic.ValidationError` around a call should catch `ResponseParseError` instead.
146
+ - Because it is a `RequestError`, a handler that retries every `RequestError` now sees it too. On a write some or all of the request may have been applied, so read the outcome back first, and never retry under a fresh `idempotency_key`.
147
+
142
148
  ### Pagination
143
149
 
144
150
  Order listings are cursored. The paginators follow `nextPageToken` to exhaustion:
@@ -298,8 +304,8 @@ net = Decimal(position.contracts)
298
304
  dollar strings from 0 to 1 on that same YES side, which is the frame you submit a
299
305
  price in. They are no longer rounded to a whole cent, so a market quoting in
300
306
  tenths of a cent reports the price it actually trades at. `average_price` reads
301
- `None` when the holding has no single entry price, and `value_usd` and
302
- `unrealized_pnl_usd` compose from the two published figures.
307
+ `None` when the holding has no single entry price. `value_usd` composes from
308
+ `mark`, and `unrealized_pnl_usd` is measured against the cost including fees.
303
309
 
304
310
  ## License
305
311
 
@@ -93,7 +93,7 @@ client.kalshi.submit_order(order, idempotency_key="my-retry-key")
93
93
 
94
94
  ### Errors
95
95
 
96
- Every non-2xx response raises `RequestError`, carrying a stable `code`, the HTTP `status`, a `message` and the parsed `body`:
96
+ Every non-2xx response raises `RequestError`, carrying a stable `code`, the HTTP `status`, a `message` and the parsed `body`. A 2xx response whose body this client version cannot parse raises `ResponseParseError`, a subclass of `RequestError`, with its 2xx `status`, `code` set to `None`, the parsed JSON in `body`, and the validation error chained as `__cause__`. The request's outcome is then unknown. On a write, some or all of it may have been applied: a batch or a scoped cancellation answers 2xx with an outcome per entry, any of which may have failed. Read the outcome back before acting on it, and never retry under a fresh `idempotency_key`, which would submit again whatever did apply. Upgrading the client usually resolves it.
97
97
 
98
98
  ```python
99
99
  from parlayx import ApiErrorCode, RequestError
@@ -119,6 +119,12 @@ except RequestError as error:
119
119
  balance = client.polymarket.get_balance()
120
120
  ```
121
121
 
122
+ ### Upgrading to 3.3.0
123
+
124
+ - Order ids the client returns are `uuid.UUID` values, and every method that takes an order id now accepts one directly, as well as a `str`.
125
+ - A 2xx response this version cannot parse now raises `ResponseParseError` instead of pydantic's `ValidationError`. It is a `RequestError` and a `ValueError`; the pydantic error is its `__cause__`. Code that caught `pydantic.ValidationError` around a call should catch `ResponseParseError` instead.
126
+ - Because it is a `RequestError`, a handler that retries every `RequestError` now sees it too. On a write some or all of the request may have been applied, so read the outcome back first, and never retry under a fresh `idempotency_key`.
127
+
122
128
  ### Pagination
123
129
 
124
130
  Order listings are cursored. The paginators follow `nextPageToken` to exhaustion:
@@ -278,8 +284,8 @@ net = Decimal(position.contracts)
278
284
  dollar strings from 0 to 1 on that same YES side, which is the frame you submit a
279
285
  price in. They are no longer rounded to a whole cent, so a market quoting in
280
286
  tenths of a cent reports the price it actually trades at. `average_price` reads
281
- `None` when the holding has no single entry price, and `value_usd` and
282
- `unrealized_pnl_usd` compose from the two published figures.
287
+ `None` when the holding has no single entry price. `value_usd` composes from
288
+ `mark`, and `unrealized_pnl_usd` is measured against the cost including fees.
283
289
 
284
290
  ## License
285
291
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "parlayx"
7
- version = "3.2.4"
7
+ version = "3.3.0"
8
8
  description = "Official Python client for the ParlayX public API."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -39,7 +39,7 @@ Documentation = "https://docs.parlayx.com"
39
39
  # patch release that changed formatting would show up as an unexplained diff on a branch
40
40
  # that touched nothing.
41
41
  dev = [
42
- "datamodel-code-generator==0.76.1",
42
+ "datamodel-code-generator==0.81.0",
43
43
  "mypy>=1.14,<2",
44
44
  "pytest>=8,<10",
45
45
  "pytest-timeout>=2.3,<3",
@@ -10,7 +10,8 @@ Credentials come from PARLAYX_KEY_ID and PARLAYX_PRIVATE_KEY_HEX, or from `key_i
10
10
  `private_key_hex` when you pass them.
11
11
 
12
12
  `AsyncParlayX` is the same surface with `await`. Every method returns its typed payload
13
- and raises `RequestError` on any non-2xx response.
13
+ and raises `RequestError` on any non-2xx response, or its subclass `ResponseParseError` on
14
+ a 2xx response it cannot parse.
14
15
  """
15
16
 
16
17
  from ._async_client import (
@@ -18,27 +19,40 @@ from ._async_client import (
18
19
  AsyncLimitlessResource,
19
20
  AsyncParlayX,
20
21
  AsyncPolymarketResource,
22
+ AsyncPolymarketUsResource,
21
23
  AsyncProphetXResource,
24
+ AsyncSxBetResource,
22
25
  )
23
26
  from ._generated import models
24
27
  from ._generated.models import (
25
28
  AmendKalshiOrderRequest,
26
29
  AmendKalshiOrderResponse,
30
+ AmendPolymarketUsOrderRequest,
31
+ AmendPolymarketUsOrderResponse,
27
32
  ApiErrorCode,
28
33
  AuthErrorCode,
29
34
  CancelLimitlessOrdersResponse,
30
35
  CancelPolymarketOrdersResponse,
36
+ CancelPolymarketUsOrdersResponse,
31
37
  CancelStrikeOrdersResponse,
38
+ CancelSxBetOrdersRequest,
39
+ CancelSxBetOrdersResponse,
32
40
  CancelTickerOrdersResponse,
33
41
  Competition,
34
42
  DecreaseKalshiOrderRequest,
35
43
  DecreaseKalshiOrderResponse,
36
44
  Event,
37
45
  EventMarket,
46
+ FuturesGroup,
47
+ FuturesMarket,
48
+ FuturesMarketSummary,
38
49
  GetKalshiOrderFillsResponse,
39
50
  GetLimitlessOrderFillsResponse,
40
51
  GetPolymarketOrderFillsResponse,
52
+ GetPolymarketUsOrderFillsResponse,
41
53
  GetProphetXOrderFillsResponse,
54
+ GetSxBetOrderFillsResponse,
55
+ IdempotencyBadRequestErrorCode,
42
56
  KalshiBalance,
43
57
  KalshiBatchOrder,
44
58
  KalshiFillView,
@@ -48,10 +62,12 @@ from ._generated.models import (
48
62
  KalshiOrderSide,
49
63
  KalshiOrderType,
50
64
  KalshiOrderView,
65
+ KalshiOutcomeSide,
51
66
  KalshiPosition,
52
67
  LimitlessBalance,
53
68
  LimitlessOrderRequest,
54
69
  LimitlessOrderView,
70
+ ListCompetitionFuturesResponse,
55
71
  ListCompetitionsResponse,
56
72
  ListEventMarketsResponse,
57
73
  ListEventsResponse,
@@ -63,9 +79,13 @@ from ._generated.models import (
63
79
  ListLimitlessPositionsResponse,
64
80
  ListPolymarketOrdersResponse,
65
81
  ListPolymarketPositionsResponse,
82
+ ListPolymarketUsOrdersResponse,
83
+ ListPolymarketUsPositionsResponse,
66
84
  ListProphetXOrdersResponse,
67
85
  ListProphetXPositionsResponse,
68
86
  ListSportsResponse,
87
+ ListSxBetOrdersResponse,
88
+ ListSxBetPositionsResponse,
69
89
  LookupMarketResponse,
70
90
  Outcome,
71
91
  PolymarketBalance,
@@ -80,6 +100,23 @@ from ._generated.models import (
80
100
  PolymarketPosition,
81
101
  PolymarketSide,
82
102
  PolymarketUncancelledOrder,
103
+ PolymarketUsAction,
104
+ PolymarketUsAppliedSelfTradePrevention,
105
+ PolymarketUsBalance,
106
+ PolymarketUsDayTimeInForce,
107
+ PolymarketUsFillView,
108
+ PolymarketUsGttTimeInForce,
109
+ PolymarketUsListing,
110
+ PolymarketUsManualOrderIndicator,
111
+ PolymarketUsMarket,
112
+ PolymarketUsOrderPreview,
113
+ PolymarketUsOrderPreviewRequest,
114
+ PolymarketUsOrderRequest,
115
+ PolymarketUsOrderType,
116
+ PolymarketUsOrderView,
117
+ PolymarketUsOutcome,
118
+ PolymarketUsPosition,
119
+ PolymarketUsSelfTradePrevention,
83
120
  ProphetXBalance,
84
121
  ProphetXBatchOrder,
85
122
  ProphetXFailedOrder,
@@ -105,9 +142,20 @@ from ._generated.models import (
105
142
  SubmitPolymarketOrderResponse,
106
143
  SubmitPolymarketOrdersRequest,
107
144
  SubmitPolymarketOrdersResponse,
145
+ SubmitPolymarketUsOrdersRequest,
146
+ SubmitPolymarketUsOrdersResponse,
108
147
  SubmitProphetXOrderResponse,
109
148
  SubmitProphetXOrdersRequest,
110
149
  SubmitProphetXOrdersResponse,
150
+ SubmitSxBetOrderResponse,
151
+ SubmitSxBetOrdersRequest,
152
+ SubmitSxBetOrdersResponse,
153
+ SxBetBalance,
154
+ SxBetLadder,
155
+ SxBetListing,
156
+ SxBetMarket,
157
+ SxBetOrderRequest,
158
+ SxBetOrderView,
111
159
  TradingOrderStatus,
112
160
  TradingOrderType,
113
161
  WhoamiResponse,
@@ -118,9 +166,13 @@ from .client import (
118
166
  ParlayX,
119
167
  PolymarketOrder,
120
168
  PolymarketResource,
169
+ PolymarketUsCancelAllResult,
170
+ PolymarketUsCancelFailure,
171
+ PolymarketUsResource,
121
172
  ProphetXResource,
173
+ SxBetResource,
122
174
  )
123
- from .errors import RequestError
175
+ from .errors import RequestError, ResponseParseError
124
176
  from .pagination import (
125
177
  apaginate_kalshi_orders,
126
178
  apaginate_polymarket_orders,
@@ -131,26 +183,39 @@ from .pagination import (
131
183
  __all__ = [
132
184
  "AmendKalshiOrderRequest",
133
185
  "AmendKalshiOrderResponse",
186
+ "AmendPolymarketUsOrderRequest",
187
+ "AmendPolymarketUsOrderResponse",
134
188
  "ApiErrorCode",
135
189
  "AsyncKalshiResource",
136
190
  "AsyncLimitlessResource",
137
191
  "AsyncParlayX",
138
192
  "AsyncPolymarketResource",
193
+ "AsyncPolymarketUsResource",
139
194
  "AsyncProphetXResource",
195
+ "AsyncSxBetResource",
140
196
  "AuthErrorCode",
141
197
  "CancelLimitlessOrdersResponse",
142
198
  "CancelPolymarketOrdersResponse",
199
+ "CancelPolymarketUsOrdersResponse",
143
200
  "CancelStrikeOrdersResponse",
201
+ "CancelSxBetOrdersRequest",
202
+ "CancelSxBetOrdersResponse",
144
203
  "CancelTickerOrdersResponse",
145
204
  "Competition",
146
205
  "DecreaseKalshiOrderRequest",
147
206
  "DecreaseKalshiOrderResponse",
148
207
  "Event",
149
208
  "EventMarket",
209
+ "FuturesGroup",
210
+ "FuturesMarket",
211
+ "FuturesMarketSummary",
150
212
  "GetKalshiOrderFillsResponse",
151
213
  "GetLimitlessOrderFillsResponse",
152
214
  "GetPolymarketOrderFillsResponse",
215
+ "GetPolymarketUsOrderFillsResponse",
153
216
  "GetProphetXOrderFillsResponse",
217
+ "GetSxBetOrderFillsResponse",
218
+ "IdempotencyBadRequestErrorCode",
154
219
  "KalshiBalance",
155
220
  "KalshiBatchOrder",
156
221
  "KalshiFillView",
@@ -160,12 +225,14 @@ __all__ = [
160
225
  "KalshiOrderSide",
161
226
  "KalshiOrderType",
162
227
  "KalshiOrderView",
228
+ "KalshiOutcomeSide",
163
229
  "KalshiPosition",
164
230
  "KalshiResource",
165
231
  "LimitlessBalance",
166
232
  "LimitlessOrderRequest",
167
233
  "LimitlessOrderView",
168
234
  "LimitlessResource",
235
+ "ListCompetitionFuturesResponse",
169
236
  "ListCompetitionsResponse",
170
237
  "ListEventMarketsResponse",
171
238
  "ListEventsResponse",
@@ -177,9 +244,13 @@ __all__ = [
177
244
  "ListLimitlessPositionsResponse",
178
245
  "ListPolymarketOrdersResponse",
179
246
  "ListPolymarketPositionsResponse",
247
+ "ListPolymarketUsOrdersResponse",
248
+ "ListPolymarketUsPositionsResponse",
180
249
  "ListProphetXOrdersResponse",
181
250
  "ListProphetXPositionsResponse",
182
251
  "ListSportsResponse",
252
+ "ListSxBetOrdersResponse",
253
+ "ListSxBetPositionsResponse",
183
254
  "LookupMarketResponse",
184
255
  "Outcome",
185
256
  "ParlayX",
@@ -197,6 +268,26 @@ __all__ = [
197
268
  "PolymarketResource",
198
269
  "PolymarketSide",
199
270
  "PolymarketUncancelledOrder",
271
+ "PolymarketUsAction",
272
+ "PolymarketUsAppliedSelfTradePrevention",
273
+ "PolymarketUsBalance",
274
+ "PolymarketUsCancelAllResult",
275
+ "PolymarketUsCancelFailure",
276
+ "PolymarketUsDayTimeInForce",
277
+ "PolymarketUsFillView",
278
+ "PolymarketUsGttTimeInForce",
279
+ "PolymarketUsListing",
280
+ "PolymarketUsManualOrderIndicator",
281
+ "PolymarketUsMarket",
282
+ "PolymarketUsOrderPreview",
283
+ "PolymarketUsOrderPreviewRequest",
284
+ "PolymarketUsOrderRequest",
285
+ "PolymarketUsOrderType",
286
+ "PolymarketUsOrderView",
287
+ "PolymarketUsOutcome",
288
+ "PolymarketUsPosition",
289
+ "PolymarketUsResource",
290
+ "PolymarketUsSelfTradePrevention",
200
291
  "ProphetXBalance",
201
292
  "ProphetXBatchOrder",
202
293
  "ProphetXFailedOrder",
@@ -215,6 +306,7 @@ __all__ = [
215
306
  "ReplaceLimitlessOrdersRequest",
216
307
  "ReplaceLimitlessOrdersResponse",
217
308
  "RequestError",
309
+ "ResponseParseError",
218
310
  "ServerTimeResponse",
219
311
  "Sport",
220
312
  "SubmitKalshiOrderResponse",
@@ -224,9 +316,21 @@ __all__ = [
224
316
  "SubmitPolymarketOrderResponse",
225
317
  "SubmitPolymarketOrdersRequest",
226
318
  "SubmitPolymarketOrdersResponse",
319
+ "SubmitPolymarketUsOrdersRequest",
320
+ "SubmitPolymarketUsOrdersResponse",
227
321
  "SubmitProphetXOrderResponse",
228
322
  "SubmitProphetXOrdersRequest",
229
323
  "SubmitProphetXOrdersResponse",
324
+ "SubmitSxBetOrderResponse",
325
+ "SubmitSxBetOrdersRequest",
326
+ "SubmitSxBetOrdersResponse",
327
+ "SxBetBalance",
328
+ "SxBetLadder",
329
+ "SxBetListing",
330
+ "SxBetMarket",
331
+ "SxBetOrderRequest",
332
+ "SxBetOrderView",
333
+ "SxBetResource",
230
334
  "TradingOrderStatus",
231
335
  "TradingOrderType",
232
336
  "WhoamiResponse",