Round-4 dogfood: getOrders crash, orderId truncation, spot reduceOnly#333
Merged
Conversation
… spot reduceOnly, ambiguous portfolio rows Walked the never-tested mutation paths (modify / partial close / notional cashQty / second-venue stops). Four catches, all live-verified on okx+bybit demo after fixing: 1. getOrders was COMPLETELY broken over the SDK: summarizeOrder called Decimal methods (.equals) on Order fields that arrive as plain JSON strings over HTTP — "totalQuantity.equals is not a function" on every listing. Rewritten on the value-tolerant compactors. (This also explains how the bug survived: the in-process path has real Decimals; only the split-process SDK path crashed.) 2. Order ids float-truncated in summaries: the inner IBKR-shaped order.orderId is a number — 19-digit CCXT ids lost their tail (…344 → …300), which would have made every downstream modify/cancel-by-id silently target a nonexistent order. Summaries now read the top-level string orderId. 3. closePosition sent reduceOnly on SPOT closes — a derivatives-only concept; okx rejects it outright (51205, observed on a partial spot close). reduceOnly now rides only on CRYPTO_PERP/FUT positions. Partial close live-verified: SELL 0.009 filled @1664.95. 4. getPortfolio rows carried symbol but neither secType nor aliceId — ETH spot and ETH perp rendered as two identical "ETH" rows, and the agent had no id to close either. Both fields added. Verified working this round with no fixes needed: modifyOrder end-to-end (price+qty amendment landed on okx, ids intact), cashQty notional market buy (ticker-converted size, filled + tracked), bybit STP via the new trigger mapping (accepted, tracked, cancelled). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
luokerenx4
pushed a commit
that referenced
this pull request
Jun 12, 2026
…d loop Five self-bootstrapped test rounds found ~20 real bugs (PRs #325–#333) that neither unit tests nor human UI sessions would ever hit: they only exist on the real usage path, through the agent surface, against real venue behavior. docs/uta-live-testing.md distills those rounds into a repeatable catalog — S1–S12 covering read-state agreement, order lifecycle, amendments, attached TP/SL (verify on the VENUE, the ledger lied once), standalone stops in algo namespaces, external-order observation, restart survival, partial closes, notional entries, error ergonomics and staging undo — plus a new-broker acceptance checklist (listing must SEE a real order, string ids end-to-end, in-kind fees as reconcile dust, venue quirks documented in the exchange's override file). CLAUDE.md points at it from the subsystem guides: trading-path changes run the relevant scenarios; new brokers run the full catalog before being called supported. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fourth self-bootstrapped test run, targeting the never-exercised mutation paths. Four catches, all fixed + live-verified:
…344 → …300) — every downstream modify/cancel-by-id would silently miss; summaries now use the top-level string id.reduceOnly(derivatives-only; okx 51205) — partial spot closes were impossible; now gated by secType. Live: partial close 0.009 ETH filled.Verified clean with no fix needed: modifyOrder end-to-end (price+qty amend on okx), cashQty notional buys, bybit STP via the new trigger mapping (accepted/tracked/cancelled).
Test plan
pnpm test1895 passing; root tsc cleanBoundary touch
CCXT closePosition params; agent-facing order summaries.
🤖 Generated with Claude Code