Skip to content

feat(orderbook): send a selectable share of each ladder round as market orders - #351

Merged
jackhai9 merged 1 commit into
mainfrom
feat/ladder-taker-orders
Nov 11, 2026
Merged

jackhai9 merged 1 commit into
mainfrom
feat/ladder-taker-orders

Conversation

@jackhai9

Copy link
Copy Markdown
Owner

Summary

Orderbook 2.7.249 adds ladder taker orders. The ladder title row reads 阶梯下单 · 吃单 followed by 关 / 20% / 50% / 80%, stored per mode + symbol + precision and off by default (off = unchanged behavior).

  • Each round first sends its taker share as native MARKET orders (nearest levels' quantities), then reprices the remaining levels and places them Post Only.
  • One-round ladder: max(1, floor(orders × ratio)). Continuous close: remainder carries across rounds, at most ceil(orders × ratio) per round and at most one owed order.
  • The ratio is read once per round; changing it applies from the next round without interrupting the current one.

Safety

  • Market orders are never retried on an unknown outcome. The budget unit is spent before the click and returned only when no request left the page, or one settled 2xx JSON response has success:false with a definite code (-1000/-1006/-1007/-1008 excluded). 90802022 enters the existing reduce-only recovery and the slot is retried once after replacement.
  • Other outcomes are resolved from the trusted account stream by client order ID within 5 s; otherwise the session stops (吃单结果未确认,已停止).
  • The fetch hook checks the native place-order body before it leaves the page: a taker must be exactly the planned MARKET order (symbol, side, positionSide, quantity, client ID); a ladder maker must not be MARKET. Mismatches are blocked and refused again for 60 s.
  • The form always returns to Post Only before any error propagates; failure to return stops the task. A dialog that appears after the click stops the task without confirming it.
  • MARKET_LOT_SIZE (min/step/max) or a missing account stream turns the round's taker share into Post Only with the reason kept on the final status.

Stats

The 吃单 title tooltip shows four lines for the latest task: order count, fills above/below the previous fill, and favorable/unfavorable/flat/no-data/pending counts 5 s and 30 s after each fill. Per-order detail is logged with [TAKER].

Evidence and validation

  • Live (JCTUSDT, 2026-11-11, user-authorized 1-JCT market close-long): MARKET form has only a quantity input; body {symbol,type:"MARKET",side:"SELL",positionSide:"LONG",quantity:1,newClientOrderId,placeType}; response success:true,status:"NEW",avgPrice:"0",reduceOnly:true; stream NEW then TRADE/FILLED; no confirmation dialog.
  • 21 new e2e scenarios and 18 unit tests; mutation checks fail the corresponding tests when the refund, single allocation, body check, Post Only restore, stream adjudication, or strict rejection rule is removed.
  • npm test 2684 passed; npm run test:ui 692 passed; lint:tests, lint:ui-copy, check:binance-userscripts, check:binance-orderbook-trade, git diff --check pass.
  • Two independent read-only reviews (design, implementation); all findings addressed.
  • Also stabilizes two replacement tests that asserted a transient status and an async console argument.
  • Not yet exercised on a live page with the new code.

🤖 Generated with Claude Code

…et orders

The ladder title row gains taker chips (关/20%/50%/80%), stored per mode,
symbol and precision like the other ladder options and off by default. Each
round first sends its taker share as native MARKET orders using the nearest
levels' quantities, then reprices the remaining levels and places them Post
Only. A one-round ladder takes max(1, floor(orders x ratio)); a continuous
close carries the remainder across rounds, never exceeding ceil(orders x
ratio) per round and carrying at most one owed order.

Market orders never retry an unknown outcome. The budget unit is spent before
the click and returned only when no request left the page or one settled 2xx
JSON response rejected it with a definite code (90802022 then enters the
existing reduce-only recovery). Otherwise the account stream must report the
client order ID within 5 s, or the session stops. The fetch hook checks the
native body before it leaves the page: a taker must be exactly the planned
MARKET order and a maker must not be MARKET; mismatches are blocked and
briefly refused on retry. The form always returns to Post Only before errors
propagate, and a new dialog after the click stops without confirming it.

The title tooltip summarizes taker fills for the latest task in four lines.
Live evidence: a user-authorized 1-JCT market close-long on 2026-11-11.

Also stabilizes two replacement tests that asserted a transient status and an
asynchronously serialized console argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jackhai9
jackhai9 merged commit e6fda08 into main Nov 11, 2026
2 checks passed
@jackhai9
jackhai9 deleted the feat/ladder-taker-orders branch November 11, 2026 02:39
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