Skip to content

fix(orderbook): check taker notional at the mark price and keep settings changes recoverable - #353

Merged
jackhai9 merged 1 commit into
mainfrom
fix/taker-mark-price
Nov 11, 2026
Merged

jackhai9 merged 1 commit into
mainfrom
fix/taker-mark-price

Conversation

@jackhai9

Copy link
Copy Markdown
Owner

Problems (live, JCTUSDT)

  1. A raised opening market order was rejected with 90804164 ("订单名义价值不得小于5"): Binance values MARKET orders at the mark price for MIN_NOTIONAL (docs), and the mark price was below the book.
  2. A continuous close stopped at round 176/184 with 执行中价格精度已变化,已停止 · 只减仓订单被拒绝 … 90802022: the precision change fell inside reduce-only recovery, where every error was wrapped as a terminal recovery failure. Outside that window the same change continues the session, so it looked intermittent.

Changes (2.7.251)

Taker notional

  • OPEN taker quantity covers 102% of MIN_NOTIONAL at min(best bid, best ask, mark); CLOSE unchanged.
  • Mark price read from the ticker by its visible label (标记价格 zh-CN, Mark en, both observed 2026-11-11): exactly one label with a single value container; value must lie in [bid −5%, ask +5%] (works with coarse/aggregated books).
  • Missing/ambiguous label or out-of-band value → slot Post Only + one-time taker-mark-price dependency alert; placeholder (--) → Post Only silently.
  • 90804164 → round's remaining slots Post Only instead of failing the round.

Reduce-only recovery

  • precision_changed / options_changed pass through the recovery runner so the session continues with the new settings next round; the recovery rebuild reports option changes as options_changed (was a terminal English error).
  • A failed replacement (open dialog, unconfirmed receipt…) is evaluated before the context and stays terminal; the cancellation adapter returns settings_changed only when its scope check raised the change (no unknown cancellation outcome); confirmed identities are recorded before that check.
  • Symbol/mode changes and failed recovery steps still end the session. The taker share is read once per round and unaffected.

Validation

  • Live read-only: the reader returned exactly one value on JCTUSDT matching /fapi/v1/premiumIndex within 0.1%; English page label Mark with value 73,745.9 observed.
  • New unit tests (recovery pass-through, replacement-failure priority, band incl. coarse books, notional raise) and e2e scenarios (mark below book, English label, missing/duplicate/hidden/out-of-band/placeholder labels, CLOSE without mark, 90804164 continuation); regressions failed before the fixes.
  • npm test 2693 passed; npm run test:ui 706 passed; lint:tests, lint:ui-copy, check:binance-userscripts, check:binance-orderbook-trade, git diff --check pass.
  • Independent read-only reviews (two rounds); findings addressed.
  • Not yet exercised live with the new code.

🤖 Generated with Claude Code

…ngs changes recoverable

Opening taker orders: Binance values MARKET orders at the mark price for
MIN_NOTIONAL. A raised JCTUSDT open short was still rejected with 90804164
because the mark price sat below the book. Taker quantity now covers 102% of
the minimum at min(best bid, best ask, mark). The mark price is read from the
ticker by its visible label (标记价格 / Mark, both observed): exactly one
label with a single value container counts, and the value must lie between
bid -5% and ask +5%. A missing or ambiguous label, or an out-of-band value,
places the slot Post Only and raises the taker-mark-price dependency alert; a
placeholder value does so silently. A 90804164 rejection now places the
round's remaining slots Post Only instead of failing the round.

Reduce-only recovery: a JCTUSDT continuous close stopped at round 176/184
because a precision change fell inside the recovery window, where every error
was wrapped as a terminal recovery failure. precision_changed and
options_changed now pass through so the session continues with the new
settings, as it does outside recovery; the recovery rebuild reports option
changes as options_changed. A failed replacement is evaluated first and stays
terminal; the cancellation adapter reports a settings change only when no
cancellation outcome is unknown, and confirmed identities are recorded before
its scope check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jackhai9
jackhai9 merged commit 6b8d428 into main Nov 11, 2026
2 checks passed
@jackhai9
jackhai9 deleted the fix/taker-mark-price branch November 11, 2026 05:10
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.

1 participant