fix(longbridge): keep GTC/GTD orders alive on transient Expired status - #1125
fix(longbridge): keep GTC/GTD orders alive on transient Expired status#1125FaintGhost wants to merge 1 commit into
Conversation
Longbridge marks US-equity GTC/GTD orders as Expired (status 16) between trading sessions; the state reverts to New once the market reopens. The previous mapping treated Expired as Inactive, which the UTA sync loop interpreted as a terminal rejection — the order was dropped from the pending queue and never re-observed, even though it was still alive at the broker (observed live: an NVDA GTC limit filled later and a NET GTC limit stayed open, both misreported as rejected). Disambiguate with timeInForce: Day orders (1) really expire at close and stay Inactive; GTC (2) / GTD (3) Expired maps to Submitted so the sync poller keeps watching until the order fills, cancels, or truly dies.
|
@FaintGhost is attempting to deploy a commit to the luokerenx4's Team Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the detailed live evidence here — the GTC failure mode is convincing, especially the order that later filled after UTA had already made the transient Before we reproduce this on a maintainer-owned branch, could you help us pin down a few Longbridge-specific semantics? We do not currently have a Longbridge test account, and this is a trading state-machine boundary where we would rather use venue evidence than infer behavior.
Our external contribution policy means we will not directly merge a cross-repository trading-surface branch; we use strong external PRs as implementation proposals and reimplement accepted changes on a maintainer-owned branch. Your report and analysis will be credited in |
Problem
Longbridge reports US-equity GTC/GTD limit orders as
Expired(status 16) between trading sessions — a transient venue state that reverts toNewonce the market reopens. The broker adapter mappedExpired → Inactive, and the UTA order-sync loop treats any non-Submittedstate as terminal (rejected). The order was then dropped from the pending queue and never re-observed.Live evidence (longbridge-main account): three GTC limits submitted together:
So the UTA state machine and the broker disagreed, and the discrepancy was only discoverable by querying the broker directly.
Fix
Disambiguate
Expiredwith the order'stimeInForce:Expired+ Day (1) →Inactive(a Day order genuinely expires unfilled at close)Expired+ GTC (2) / GTD (3) →Submitted(transient between sessions; keep the order in the pending queue so the sync poller keeps observing it until it fills, cancels, or truly terminates)makeOrderStatenow accepts and forwardstimeInForce;mapOpenOrdersupplies it from the broker response.Verification
LongbridgeBroker.spec.ts, including 4 new cases covering the Expired/TIF matrix