#1585·OpenAlice

modifyOrder bypasses per-exchange payload shaping: an amended order on a hedged account carries no position-side field

Author: 2233adminCreated Sep 22, 2026Updated Sep 22, 2026

Symptom

On an exchange where a hedged (dual-side) account rejects an order that does not name the position leg (OKX 51000, Binance -4061, Bitget 40774), amending an existing order sends the amendment without that field: modifyOrder calls ccxt directly and never passes through the per-exchange order overrides.

Where

  • services/uta/src/domain/trading/brokers/ccxt/CcxtBroker.ts:686 calls exchange.editOrder directly.
  • Reachable from services/uta/src/domain/trading/UnifiedTradingAccount.ts:187-188.
  • By contrast the placement path does go through the per-exchange overrides (CcxtBroker.ts:619-626), which is the only place per-exchange payload shaping exists.

Reproduction

  1. Configure an account on a venue that is in hedge / long-short / dual-side position mode.
  2. Place an order — accepted.
  3. Amend that order.
  4. The venue refuses the amendment for a missing position-side field (51000 / -4061 / 40774), because editOrder was called without posSide / positionSide / tradeSide.

Expected

An amendment should carry the same position-mode fields the placement path carries for that venue, derived the same way (read from the venue's own endpoint at send time, not guessed from the order side).

Impact

Fails closed — the venue refuses rather than silently moving the wrong leg — but a hedged account cannot amend orders at all.

Subsystem

UTA broker layer: services/uta/src/domain/trading/brokers/ccxt/ (order-write path).

Why deferred rather than fixed here

Different entry point from the placement path, with its own payload and error surface, so it needs its own change and its own verification round. It was found while adding position-mode-aware placement for Binance/Bitget/OKX and deliberately left out of that change to keep its claim narrow.

Evidence

Independent verification pass on commit 24e229453 (local worktree D:/temp/oa-uta-fix, branch fix/uta-wallet-lock-and-hedge-posside), finding (a): the seam that shapes the placement payload is not on the modifyOrder path, with the CcxtBroker.ts:686 / UnifiedTradingAccount.ts:187-188 citation and the observation that the amendment therefore carries no position-mode field.