Skip to content

Fix extended-hours orders: market_hours must match extended_hours - #42

Merged
finlayi merged 4 commits into
finlayi:mainfrom
mdicarlo-scaled:fix/extended-hours-market-hours
Jul 22, 2026
Merged

Fix extended-hours orders: market_hours must match extended_hours#42
finlayi merged 4 commits into
finlayi:mainfrom
mdicarlo-scaled:fix/extended-hours-market-hours

Conversation

@mdicarlo-scaled

Copy link
Copy Markdown
Contributor

Problem

Stock orders always send "market_hours": "regular_hours" in the order payload, even when --extended-hours is set. The Robinhood order API rejects the contradictory combination:

400 {"non_field_errors":["Extended hours and market hours mismatch."]}

so every --extended-hours order fails with BROKER_REJECTED.

Repro:

TOKEN=$(rhx --json live on --yes | jq -r '.data.live_confirm_token')
rhx --json orders stock place --symbol NG --side buy --type limit \
  --limit-price 4.50 --qty 1 --extended-hours --time-in-force gfd \
  --live-confirm-token "$TOKEN"
# -> BROKER_REJECTED: Extended hours and market hours mismatch.

Fix

Set market_hours to "extended_hours" when intent.ExtendedHours is true (payload construction in pkg/rhx/brokerage_orders.go).

Verification

  • go test ./... passes.
  • Verified against the live API: the exact order above (previously rejected) is accepted with this change (state: unconfirmed), and behaves normally through cancel.

🤖 Generated with Claude Code

Stock orders always sent "market_hours": "regular_hours", even when
--extended-hours was set. The Robinhood order API rejects that
combination with:

    400 {"non_field_errors":["Extended hours and market hours mismatch."]}

so every extended-hours order failed. Set market_hours to
"extended_hours" when the extended-hours flag is on.

Verified against the live API: an --extended-hours limit order that
previously drew the 400 above is accepted with this change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mdicarlo-scaled
mdicarlo-scaled requested a review from finlayi as a code owner July 22, 2026 13:37

@finlayi finlayi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified implementation, regression coverage, release metadata, and green Go/NPM/native CI.

@finlayi
finlayi merged commit 2f016cb into finlayi:main Jul 22, 2026
3 checks passed
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.

2 participants