Skip to content

Docs: orders.md batch_create example crashes under the v2.4 return type #247

Closed

Description

@TexasCoding

Summary

Copy-paste from the docs raises TypeError/AttributeError on the first batch-create call. Orders are placed on the wire but the script crashes before the caller can confirm fills, leading to duplicate-order risk if the user retries.

The example still shows the v2.3 list[Order] shape that was replaced in #194 by BatchCreateOrdersResponse whose entries expose .order: Order | None and .error: dict | None.

Location

  • docs/resources/orders.md:107-117 — broken example
  • kalshi/resources/orders.py:468-487 — current return type
  • kalshi/models/orders.py:367-379 — BatchCreateOrdersResponse shape

Evidence

# docs/resources/orders.md (current, broken):
created = client.orders.batch_create(orders)
for o in created:
    print(o.order_id, o.status)

The resource now returns BatchCreateOrdersResponse, whose only public field is orders: list[BatchCreateOrdersResponseEntry] (model_config={'extra':'allow'}), and each entry exposes .order: Order | None and .error: dict | None — not .order_id or .status on the entry itself.

Recommended fix

Rewrite the example to iterate created.orders and unpack (entry.order, entry.error) with the standard "check error first" pattern, mirroring the existing batch_create_v2 example a few sections later.

Severity & category

high / docs

Activity

  1. added a commit that references this issue on May 21, 2026
    d59912b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions