Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions docs/resources/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ orders = [
CreateOrderRequest(ticker="X-YES", side="yes", action="buy", count=10, yes_price="0.60"),
CreateOrderRequest(ticker="X-NO", side="no", action="buy", count=10, no_price="0.42"),
]
created = client.orders.batch_create(orders)
for o in created:
print(o.order_id, o.status)
result = client.orders.batch_create(orders)
for entry in result.orders:
if entry.error is not None:
print("failed:", entry.client_order_id, entry.error)
else:
print(entry.order.order_id, entry.order.status)
```

Each child has `extra="forbid"`, so a typo in any leg fails at construction
Expand All @@ -122,16 +125,22 @@ before the round trip.
## Cancel

```python
client.orders.cancel("ord_abc") # single
client.orders.batch_cancel(["ord_abc", "ord_def"]) # convenience: list of strings
client.orders.cancel("ord_abc") # single

result = client.orders.batch_cancel(["ord_abc", "ord_def"]) # list of strings
for entry in result.orders:
if entry.error is not None:
print("failed:", entry.order_id, entry.error)
else:
print(entry.order_id, "canceled", entry.reduced_by_fp)
```

For per-entry subaccount routing, build the request explicitly:

```python
from kalshi import BatchCancelOrdersRequestOrder

client.orders.batch_cancel([
result = client.orders.batch_cancel([
BatchCancelOrdersRequestOrder(order_id="ord_abc", subaccount=0),
BatchCancelOrdersRequestOrder(order_id="ord_def", subaccount=1),
])
Expand Down
Loading