parlayx 3.2.3__tar.gz → 3.2.5__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.
- {parlayx-3.2.3 → parlayx-3.2.5}/PKG-INFO +5 -10
- {parlayx-3.2.3 → parlayx-3.2.5}/README.md +4 -9
- {parlayx-3.2.3 → parlayx-3.2.5}/pyproject.toml +1 -1
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_async_client.py +9 -8
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_generated/models.py +34 -37
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_generated/stream.py +3 -3
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/client.py +9 -8
- {parlayx-3.2.3 → parlayx-3.2.5}/.gitignore +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/LICENSE +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/__init__.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_generated/__init__.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_signing.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/_transport.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/errors.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/pagination.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/py.typed +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/stream/__init__.py +0 -0
- {parlayx-3.2.3 → parlayx-3.2.5}/src/parlayx/stream/_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: parlayx
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.5
|
|
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
|
|
@@ -71,16 +71,15 @@ from parlayx import KalshiOrderRequest
|
|
|
71
71
|
order = client.kalshi.submit_order(
|
|
72
72
|
KalshiOrderRequest(
|
|
73
73
|
ticker="KXMLBGAME-26SEP01-NYY",
|
|
74
|
-
side="
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
price_cents=45,
|
|
74
|
+
side="BID",
|
|
75
|
+
count="10",
|
|
76
|
+
price="0.45",
|
|
78
77
|
)
|
|
79
78
|
)
|
|
80
79
|
print(order.order_id, order.status)
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
Fields accept either spelling
|
|
82
|
+
Fields accept either spelling, such as `time_in_force` or `timeInForce`. The wire always carries the API's own camelCase.
|
|
84
83
|
|
|
85
84
|
Both `client.polymarket` and `client.kalshi` carry seven core methods: `submit_order`, `list_orders`, `get_order`, `cancel_order`, `get_order_fills`, `list_positions` and `get_balance`.
|
|
86
85
|
|
|
@@ -218,10 +217,6 @@ Set `time_in_force={"type": "FOK"}` for the venue's fill-or-kill, where an order
|
|
|
218
217
|
|
|
219
218
|
`price` is the cost of one share in dollars, greater than 0 and less than 1, with at most six decimal places. ProphetX quotes a fixed set of prices, and one it does not quote is placed at the nearest it does quote at or below the price you sent, so an order never fills worse than you asked. `submit_order` reports the price actually placed on its response, and `get_ladder` returns the set.
|
|
220
219
|
|
|
221
|
-
### One inconsistency worth knowing
|
|
222
|
-
|
|
223
|
-
Discovery listings report `venue` in uppercase (`KALSHI`, `POLYMARKET`), while the order and streaming surfaces take it lowercase. The client passes the value through unchanged in both directions rather than quietly rewriting it.
|
|
224
|
-
|
|
225
220
|
## Connections
|
|
226
221
|
|
|
227
222
|
From 3.2.3 the client keeps its connection to the API open between requests, so
|
|
@@ -51,16 +51,15 @@ from parlayx import KalshiOrderRequest
|
|
|
51
51
|
order = client.kalshi.submit_order(
|
|
52
52
|
KalshiOrderRequest(
|
|
53
53
|
ticker="KXMLBGAME-26SEP01-NYY",
|
|
54
|
-
side="
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
price_cents=45,
|
|
54
|
+
side="BID",
|
|
55
|
+
count="10",
|
|
56
|
+
price="0.45",
|
|
58
57
|
)
|
|
59
58
|
)
|
|
60
59
|
print(order.order_id, order.status)
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
Fields accept either spelling
|
|
62
|
+
Fields accept either spelling, such as `time_in_force` or `timeInForce`. The wire always carries the API's own camelCase.
|
|
64
63
|
|
|
65
64
|
Both `client.polymarket` and `client.kalshi` carry seven core methods: `submit_order`, `list_orders`, `get_order`, `cancel_order`, `get_order_fills`, `list_positions` and `get_balance`.
|
|
66
65
|
|
|
@@ -198,10 +197,6 @@ Set `time_in_force={"type": "FOK"}` for the venue's fill-or-kill, where an order
|
|
|
198
197
|
|
|
199
198
|
`price` is the cost of one share in dollars, greater than 0 and less than 1, with at most six decimal places. ProphetX quotes a fixed set of prices, and one it does not quote is placed at the nearest it does quote at or below the price you sent, so an order never fills worse than you asked. `submit_order` reports the price actually placed on its response, and `get_ladder` returns the set.
|
|
200
199
|
|
|
201
|
-
### One inconsistency worth knowing
|
|
202
|
-
|
|
203
|
-
Discovery listings report `venue` in uppercase (`KALSHI`, `POLYMARKET`), while the order and streaming surfaces take it lowercase. The client passes the value through unchanged in both directions rather than quietly rewriting it.
|
|
204
|
-
|
|
205
200
|
## Connections
|
|
206
201
|
|
|
207
202
|
From 3.2.3 the client keeps its connection to the API open between requests, so
|
|
@@ -165,7 +165,7 @@ class AsyncPolymarketResource:
|
|
|
165
165
|
) -> CancelPolymarketOrdersResponse:
|
|
166
166
|
"""Cancel your resting orders in one request.
|
|
167
167
|
|
|
168
|
-
Scoped to your own
|
|
168
|
+
Scoped to your own credential: orders another credential placed on the same pod are
|
|
169
169
|
never touched. Narrow it to one outcome with ``token_id`` or one market with
|
|
170
170
|
``conditionId``; send at most one.
|
|
171
171
|
|
|
@@ -180,7 +180,7 @@ class AsyncPolymarketResource:
|
|
|
180
180
|
)
|
|
181
181
|
|
|
182
182
|
async def cancel_all_orders(self) -> CancelPolymarketOrdersResponse:
|
|
183
|
-
"""Cancel every resting order this
|
|
183
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
184
184
|
|
|
185
185
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
186
186
|
"""
|
|
@@ -284,7 +284,7 @@ class AsyncKalshiResource:
|
|
|
284
284
|
)
|
|
285
285
|
|
|
286
286
|
async def cancel_all_orders(self) -> CancelTickerOrdersResponse:
|
|
287
|
-
"""Cancel every resting order this
|
|
287
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
288
288
|
|
|
289
289
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
290
290
|
"""
|
|
@@ -429,8 +429,9 @@ class AsyncProphetXResource:
|
|
|
429
429
|
``succeeded_orders``, accepted but not confirmed at the venue; refused or
|
|
430
430
|
unconfirmed ones come back in ``failed_orders``. A failed entry with code
|
|
431
431
|
ORDER_RECONCILIATION_REQUIRED may still have been placed, so read its
|
|
432
|
-
``order_id`` before re-sending.
|
|
433
|
-
|
|
432
|
+
``order_id`` before re-sending. Each order may be GTC or FOK; a FOK order
|
|
433
|
+
cannot set ``postOnly``. A ``timeInForce`` of GTD is supported on
|
|
434
|
+
``submit_order`` only.
|
|
434
435
|
"""
|
|
435
436
|
return await self._client._request(
|
|
436
437
|
"POST",
|
|
@@ -494,7 +495,7 @@ class AsyncProphetXResource:
|
|
|
494
495
|
)
|
|
495
496
|
|
|
496
497
|
async def cancel_all_orders(self) -> CancelStrikeOrdersResponse:
|
|
497
|
-
"""Cancel every resting order this
|
|
498
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
498
499
|
|
|
499
500
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
500
501
|
"""
|
|
@@ -653,7 +654,7 @@ class AsyncLimitlessResource:
|
|
|
653
654
|
)
|
|
654
655
|
|
|
655
656
|
async def cancel_all_orders(self) -> CancelLimitlessOrdersResponse:
|
|
656
|
-
"""Cancel every resting order this
|
|
657
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
657
658
|
|
|
658
659
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
659
660
|
"""
|
|
@@ -736,7 +737,7 @@ class AsyncParlayX:
|
|
|
736
737
|
return parse(await self._http.send(request), model)
|
|
737
738
|
|
|
738
739
|
async def whoami(self) -> WhoamiResponse:
|
|
739
|
-
"""Identify the calling key: its
|
|
740
|
+
"""Identify the calling key: its credential, pod, scope and capabilities."""
|
|
740
741
|
return await self._request("GET", "/v1/whoami", WhoamiResponse)
|
|
741
742
|
|
|
742
743
|
async def get_time(self) -> ServerTimeResponse:
|
|
@@ -10,6 +10,22 @@ from uuid import UUID
|
|
|
10
10
|
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, RootModel
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
class KalshiOrderSide(StrEnum):
|
|
14
|
+
"""
|
|
15
|
+
Order direction on the market's YES book.
|
|
16
|
+
|
|
17
|
+
| Side | Meaning |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `BID` | Buy YES contracts, profiting if the market resolves YES. |
|
|
20
|
+
| `ASK` | Sell YES contracts, profiting if the market resolves NO. |
|
|
21
|
+
|
|
22
|
+
Selling YES is the same order as buying NO, so `ASK` covers both.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
bid = "BID"
|
|
26
|
+
ask = "ASK"
|
|
27
|
+
|
|
28
|
+
|
|
13
29
|
class WhoamiResponse(BaseModel):
|
|
14
30
|
model_config = ConfigDict(
|
|
15
31
|
populate_by_name=True,
|
|
@@ -18,25 +34,21 @@ class WhoamiResponse(BaseModel):
|
|
|
18
34
|
str,
|
|
19
35
|
Field(alias="keyId", description="The key id carried in the PX-Key-Id header."),
|
|
20
36
|
]
|
|
21
|
-
|
|
22
|
-
str,
|
|
37
|
+
credential_id: Annotated[
|
|
38
|
+
str,
|
|
39
|
+
Field(
|
|
40
|
+
alias="credentialId",
|
|
41
|
+
description="Opaque identifier of the credential this key belongs to.",
|
|
42
|
+
),
|
|
23
43
|
]
|
|
24
44
|
pod_id: Annotated[
|
|
25
45
|
str, Field(alias="podId", description="The pod this key is bound to.")
|
|
26
46
|
]
|
|
27
47
|
scope: Annotated[
|
|
28
|
-
str,
|
|
29
|
-
Field(
|
|
30
|
-
description="The principal's read scope. `actor` today; `pod`/`org` for future read-only keys.",
|
|
31
|
-
examples=["actor"],
|
|
32
|
-
),
|
|
48
|
+
str, Field(description="The read scope of the key.", examples=["trader"])
|
|
33
49
|
]
|
|
34
50
|
capabilities: Annotated[
|
|
35
|
-
list[str],
|
|
36
|
-
Field(
|
|
37
|
-
description="What the key may do. `trade` for an actor key.",
|
|
38
|
-
examples=[["trade"]],
|
|
39
|
-
),
|
|
51
|
+
list[str], Field(description="What the key may do.", examples=[["trade"]])
|
|
40
52
|
]
|
|
41
53
|
|
|
42
54
|
|
|
@@ -251,6 +263,7 @@ class KalshiListing(BaseModel):
|
|
|
251
263
|
Side,
|
|
252
264
|
Field(description="Kalshi contract side for this outcome.", examples=["YES"]),
|
|
253
265
|
]
|
|
266
|
+
book_side: Annotated[KalshiOrderSide, Field(alias="bookSide")]
|
|
254
267
|
executable: Annotated[
|
|
255
268
|
bool, Field(description="Whether this listing can be traded today.")
|
|
256
269
|
]
|
|
@@ -1175,7 +1188,7 @@ class ListPolymarketPositionsResponse(BaseModel):
|
|
|
1175
1188
|
positions: Annotated[
|
|
1176
1189
|
list[PolymarketPosition],
|
|
1177
1190
|
Field(
|
|
1178
|
-
description="Open positions held by the calling
|
|
1191
|
+
description="Open positions held by the calling credential, ordered by tokenId."
|
|
1179
1192
|
),
|
|
1180
1193
|
]
|
|
1181
1194
|
|
|
@@ -1219,22 +1232,6 @@ class SubmitKalshiOrderResponse(BaseModel):
|
|
|
1219
1232
|
]
|
|
1220
1233
|
|
|
1221
1234
|
|
|
1222
|
-
class KalshiOrderSide(StrEnum):
|
|
1223
|
-
"""
|
|
1224
|
-
Order direction on the market's YES book.
|
|
1225
|
-
|
|
1226
|
-
| Side | Meaning |
|
|
1227
|
-
| --- | --- |
|
|
1228
|
-
| `BID` | Buy YES contracts, profiting if the market resolves YES. |
|
|
1229
|
-
| `ASK` | Sell YES contracts, profiting if the market resolves NO. |
|
|
1230
|
-
|
|
1231
|
-
Selling YES is the same order as buying NO, so `ASK` covers both.
|
|
1232
|
-
"""
|
|
1233
|
-
|
|
1234
|
-
bid = "BID"
|
|
1235
|
-
ask = "ASK"
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
1235
|
class KalshiSelfTradePrevention(StrEnum):
|
|
1239
1236
|
"""
|
|
1240
1237
|
Which order is cancelled when this order would trade against your own resting order.
|
|
@@ -1496,7 +1493,7 @@ class KalshiOrderView(BaseModel):
|
|
|
1496
1493
|
str,
|
|
1497
1494
|
Field(
|
|
1498
1495
|
alias="clientOrderId",
|
|
1499
|
-
description="Your own identifier for this order
|
|
1496
|
+
description="Your own identifier for this order as you supplied it, otherwise its orderId.",
|
|
1500
1497
|
examples=["order-1"],
|
|
1501
1498
|
),
|
|
1502
1499
|
]
|
|
@@ -1530,7 +1527,7 @@ class KalshiPosition(BaseModel):
|
|
|
1530
1527
|
contracts: Annotated[
|
|
1531
1528
|
str,
|
|
1532
1529
|
Field(
|
|
1533
|
-
description="Contracts held by the calling
|
|
1530
|
+
description="Contracts held by the calling credential on the market's yes side as a decimal string, negative when the holding is on the no side.",
|
|
1534
1531
|
examples=["38"],
|
|
1535
1532
|
),
|
|
1536
1533
|
]
|
|
@@ -1573,7 +1570,7 @@ class ListKalshiPositionsResponse(BaseModel):
|
|
|
1573
1570
|
)
|
|
1574
1571
|
positions: Annotated[
|
|
1575
1572
|
list[KalshiPosition],
|
|
1576
|
-
Field(description="Open positions held by the calling
|
|
1573
|
+
Field(description="Open positions held by the calling credential."),
|
|
1577
1574
|
]
|
|
1578
1575
|
|
|
1579
1576
|
|
|
@@ -1681,7 +1678,7 @@ class KalshiFillView(BaseModel):
|
|
|
1681
1678
|
str,
|
|
1682
1679
|
Field(
|
|
1683
1680
|
alias="clientOrderId",
|
|
1684
|
-
description="Your own identifier for this order
|
|
1681
|
+
description="Your own identifier for this order as you supplied it, otherwise its orderId.",
|
|
1685
1682
|
examples=["order-1"],
|
|
1686
1683
|
),
|
|
1687
1684
|
]
|
|
@@ -2228,10 +2225,10 @@ class ProphetXBatchOrder(BaseModel):
|
|
|
2228
2225
|
Field(description="Stake in account currency units.", examples=[25], gt=0.0),
|
|
2229
2226
|
]
|
|
2230
2227
|
time_in_force: Annotated[
|
|
2231
|
-
GtcTimeInForce | None,
|
|
2228
|
+
GtcTimeInForce | ProphetXFokTimeInForce | None,
|
|
2232
2229
|
Field(
|
|
2233
2230
|
alias="timeInForce",
|
|
2234
|
-
description="Execution policy; omission uses GTC. The batch accepts GTC
|
|
2231
|
+
description="Execution policy; omission uses GTC. The batch accepts GTC or FOK. Use the single order endpoint for GTD.",
|
|
2235
2232
|
discriminator="type",
|
|
2236
2233
|
),
|
|
2237
2234
|
] = None
|
|
@@ -2448,7 +2445,7 @@ class ListProphetXPositionsResponse(BaseModel):
|
|
|
2448
2445
|
)
|
|
2449
2446
|
positions: Annotated[
|
|
2450
2447
|
list[ProphetXPosition],
|
|
2451
|
-
Field(description="Open positions held by the calling
|
|
2448
|
+
Field(description="Open positions held by the calling credential."),
|
|
2452
2449
|
]
|
|
2453
2450
|
|
|
2454
2451
|
|
|
@@ -3176,7 +3173,7 @@ class ListLimitlessPositionsResponse(BaseModel):
|
|
|
3176
3173
|
positions: Annotated[
|
|
3177
3174
|
list[LimitlessPosition],
|
|
3178
3175
|
Field(
|
|
3179
|
-
description="Open positions held by the calling
|
|
3176
|
+
description="Open positions held by the calling credential, ordered by tokenId."
|
|
3180
3177
|
),
|
|
3181
3178
|
]
|
|
3182
3179
|
|
|
@@ -312,11 +312,11 @@ class WelcomeFrame(BaseModel):
|
|
|
312
312
|
type: Literal["WELCOME"]
|
|
313
313
|
v: V
|
|
314
314
|
server_timestamp: Annotated[int, Field(alias="serverTimestamp", ge=0)]
|
|
315
|
-
|
|
315
|
+
credential_id: Annotated[
|
|
316
316
|
UUID,
|
|
317
317
|
Field(
|
|
318
|
-
alias="
|
|
319
|
-
description="
|
|
318
|
+
alias="credentialId",
|
|
319
|
+
description="Opaque identifier of the credential this connection signs as.",
|
|
320
320
|
examples=["9a4b7e2c-1a64-4dca-9d6e-1b8c2d3f4a5b"],
|
|
321
321
|
),
|
|
322
322
|
]
|
|
@@ -174,7 +174,7 @@ class PolymarketResource:
|
|
|
174
174
|
) -> CancelPolymarketOrdersResponse:
|
|
175
175
|
"""Cancel your resting orders in one request.
|
|
176
176
|
|
|
177
|
-
Scoped to your own
|
|
177
|
+
Scoped to your own credential: orders another credential placed on the same pod are
|
|
178
178
|
never touched. Narrow it to one outcome with ``token_id`` or one market with
|
|
179
179
|
``conditionId``; send at most one.
|
|
180
180
|
|
|
@@ -189,7 +189,7 @@ class PolymarketResource:
|
|
|
189
189
|
)
|
|
190
190
|
|
|
191
191
|
def cancel_all_orders(self) -> CancelPolymarketOrdersResponse:
|
|
192
|
-
"""Cancel every resting order this
|
|
192
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
193
193
|
|
|
194
194
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
195
195
|
"""
|
|
@@ -291,7 +291,7 @@ class KalshiResource:
|
|
|
291
291
|
)
|
|
292
292
|
|
|
293
293
|
def cancel_all_orders(self) -> CancelTickerOrdersResponse:
|
|
294
|
-
"""Cancel every resting order this
|
|
294
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
295
295
|
|
|
296
296
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
297
297
|
"""
|
|
@@ -434,8 +434,9 @@ class ProphetXResource:
|
|
|
434
434
|
``succeeded_orders``, accepted but not confirmed at the venue; refused or
|
|
435
435
|
unconfirmed ones come back in ``failed_orders``. A failed entry with code
|
|
436
436
|
ORDER_RECONCILIATION_REQUIRED may still have been placed, so read its
|
|
437
|
-
``order_id`` before re-sending.
|
|
438
|
-
|
|
437
|
+
``order_id`` before re-sending. Each order may be GTC or FOK; a FOK order
|
|
438
|
+
cannot set ``postOnly``. A ``timeInForce`` of GTD is supported on
|
|
439
|
+
``submit_order`` only.
|
|
439
440
|
"""
|
|
440
441
|
return self._client._request(
|
|
441
442
|
"POST",
|
|
@@ -499,7 +500,7 @@ class ProphetXResource:
|
|
|
499
500
|
)
|
|
500
501
|
|
|
501
502
|
def cancel_all_orders(self) -> CancelStrikeOrdersResponse:
|
|
502
|
-
"""Cancel every resting order this
|
|
503
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
503
504
|
|
|
504
505
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
505
506
|
"""
|
|
@@ -652,7 +653,7 @@ class LimitlessResource:
|
|
|
652
653
|
)
|
|
653
654
|
|
|
654
655
|
def cancel_all_orders(self) -> CancelLimitlessOrdersResponse:
|
|
655
|
-
"""Cancel every resting order this
|
|
656
|
+
"""Cancel every resting order this credential holds on this venue, unnarrowed.
|
|
656
657
|
|
|
657
658
|
Use ``cancel_orders`` to narrow the sweep to part of the book.
|
|
658
659
|
"""
|
|
@@ -733,7 +734,7 @@ class ParlayX:
|
|
|
733
734
|
return parse(self._http.send(request), model)
|
|
734
735
|
|
|
735
736
|
def whoami(self) -> WhoamiResponse:
|
|
736
|
-
"""Identify the calling key: its
|
|
737
|
+
"""Identify the calling key: its credential, pod, scope and capabilities."""
|
|
737
738
|
return self._request("GET", "/v1/whoami", WhoamiResponse)
|
|
738
739
|
|
|
739
740
|
def get_time(self) -> ServerTimeResponse:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|