Skip to content

Longbridge GTC orders misreported as rejected after non-trading-hours Expired status #1126

Description

@FaintGhost

Symptom

A GTC limit order submitted via UTA is marked rejected in order history while it is still alive at the broker (visible in the official Longbridge app). Another GTC order was marked rejected and later filled at its limit price with the fill completely invisible to UTA.

Reproduction / evidence

On a live Longbridge account (longbridge-c0a45adf), three GTC limit orders were pushed together on 2026-08-07 13:52 UTC:

Order Limit UTA order-history Broker truth (direct SDK orderDetail)
ARM x2 $286.68 filled ✅ Filled (5)
NVDA x3 $218.99 rejected Filled (5) — filled later at limit
NET x1 $254.00 rejected NotReported (1) — still open

Timestamps: the two spurious rejections were recorded at 2026-08-08 00:03/00:04 UTC, i.e. outside US equity trading hours.

Suspected subsystem

services/uta order sync: mapLbOrderStatus (longbridge-contracts.ts) maps Expired (16) → Inactive, and unreconcilePendingOrders (UnifiedTradingAccount.ts) treats any non-Submitted/PreSubmitted status as terminal — the order leaves the pending queue and is never re-observed. Longbridge marks US-equity GTC/GTD orders Expired between trading sessions (transient; reverts to New after reopen). Day orders are the only ones that truly expire at close.

Suggested fix

See PR #1125: disambiguate Expired via timeInForce — Day (1) stays Inactive (real expiry at close); GTC (2) / GTD (3) maps to Submitted so the sync poller keeps observing the order until it fills, cancels, or truly terminates.

Impact

State-machine divergence between UTA and broker: filled positions missing from UTA's view, phantom rejected orders, and the pending queue losing live orders. Reliable order status matters for anything automated on top of UTA (scheduled rebalances, monitoring).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions