Skip to content

Wait for order resolution after submit and modify#3

Open
willzhqiang wants to merge 1 commit into
fatwang2:mainfrom
willzhqiang:codex/wait-for-order-resolution
Open

Wait for order resolution after submit and modify#3
willzhqiang wants to merge 1 commit into
fatwang2:mainfrom
willzhqiang:codex/wait-for-order-resolution

Conversation

@willzhqiang

Copy link
Copy Markdown

Summary

  • Wait for stock order submit/modify/cancel operations to reach a terminal order status or the caller-provided timeout.
  • Reuse the same wait helper across submit, modify, and cancel paths.
  • Add unit coverage for waiting until a done status and returning immediately when already done.

Motivation

The CLI currently places or modifies an order and then waits for at most 0.75 seconds before disconnecting. On slower order-status paths, especially exchange-routed or non-US orders, the command can return before the order has reached a stable terminal state. This makes the result less reliable for users and agents that need to know whether an order was filled, cancelled, or left active.

This change makes the existing --timeout option apply to order lifecycle resolution instead of only connection setup and the initial API call.

Validation

  • uv run --extra test pytest

@willzhqiang willzhqiang marked this pull request as ready for review June 8, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant