From f45ba4da4b2679b9d2ee7608fc3948e54d272b7f Mon Sep 17 00:00:00 2001 From: LiZhenhai-MBP14 <5935568+jackhai9@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:00:48 +0800 Subject: [PATCH 1/2] fix: separate ladder plan status fields --- scripts/binance-orderbook-trade.user.js | 7 +++---- src/binance-orderbook-trade/index.user.js | 9 ++++----- test/unit/binance-orderbook-trade/ladder-options.test.js | 2 +- .../binance-orderbook-trade/source-regressions.test.js | 3 ++- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/binance-orderbook-trade.user.js b/scripts/binance-orderbook-trade.user.js index b9e497e..5745262 100644 --- a/scripts/binance-orderbook-trade.user.js +++ b/scripts/binance-orderbook-trade.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.152 +// @version 2.7.153 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* @@ -5945,9 +5945,8 @@ } } function formatLadderPlanStatus(plan) { - const levelText = plan.levels === plan.requestedLevels ? `${plan.levels}档` : `${plan.levels}/${plan.requestedLevels}档`; - const stepText = plan.ladderStep === DEFAULT_LADDER_STEP ? "" : `/幅${plan.ladderStep}`; - return `${plan.spec.label}计划:${plan.percent}%/${levelText}${stepText}`; + const levelText = plan.levels === plan.requestedLevels ? `${plan.levels}` : `${plan.levels}/${plan.requestedLevels}`; + return `${plan.spec.label}计划:比例 ${plan.percent}% · 笔数 ${levelText} · 间距 ${plan.ladderStep}`; } function isReplaceableCloseLadderOpenOrdersFailure(plan, error) { if (plan?.spec?.mode !== "CLOSE") return false; diff --git a/src/binance-orderbook-trade/index.user.js b/src/binance-orderbook-trade/index.user.js index fd1e150..3ee19a1 100644 --- a/src/binance-orderbook-trade/index.user.js +++ b/src/binance-orderbook-trade/index.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.152 +// @version 2.7.153 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* @@ -4454,10 +4454,9 @@ import { function formatLadderPlanStatus(plan) { const levelText = plan.levels === plan.requestedLevels - ? `${plan.levels}档` - : `${plan.levels}/${plan.requestedLevels}档`; - const stepText = plan.ladderStep === DEFAULT_LADDER_STEP ? '' : `/幅${plan.ladderStep}`; - return `${plan.spec.label}计划:${plan.percent}%/${levelText}${stepText}`; + ? `${plan.levels}` + : `${plan.levels}/${plan.requestedLevels}`; + return `${plan.spec.label}计划:比例 ${plan.percent}% · 笔数 ${levelText} · 间距 ${plan.ladderStep}`; } function isReplaceableCloseLadderOpenOrdersFailure(plan, error) { diff --git a/test/unit/binance-orderbook-trade/ladder-options.test.js b/test/unit/binance-orderbook-trade/ladder-options.test.js index e996c1b..f3dae2d 100644 --- a/test/unit/binance-orderbook-trade/ladder-options.test.js +++ b/test/unit/binance-orderbook-trade/ladder-options.test.js @@ -224,7 +224,7 @@ test('ladder execution and UI updates use one captured mode-symbol-precision con assert.match(source, /const optionContext = getPanelOptionContext\(\)/); assert.match(source, /setLadderLevels\(value, optionContext\.mode, optionContext\.symbol, optionContext\.precision\)/); assert.match(source, /setLadderStep\(value, optionContext\.mode, optionContext\.symbol, optionContext\.precision\)/); - assert.match(source, /plan\.ladderStep === DEFAULT_LADDER_STEP \? '' : `\/幅\$\{plan\.ladderStep\}`/); + assert.match(source, /计划:比例 \$\{plan\.percent\}% · 笔数 \$\{levelText\} · 间距 \$\{plan\.ladderStep\}/); }); test('open and close ladder percentage rows share the centralized ratio label', () => { diff --git a/test/unit/binance-orderbook-trade/source-regressions.test.js b/test/unit/binance-orderbook-trade/source-regressions.test.js index 514b34d..247e436 100644 --- a/test/unit/binance-orderbook-trade/source-regressions.test.js +++ b/test/unit/binance-orderbook-trade/source-regressions.test.js @@ -833,7 +833,8 @@ test('ladder task statuses name the active action and observed outcome', () => { assert.match(startBody, /formatFailedLadderProgress\(spec\.label,\s*failureMessage,\s*progress\)/); assert.match(stopBody, /`\$\{activeSpec\.label\}停止中`/); assert.match(cancelPlanBody, /setPlanStepStatus\(`撤销 \$\{rowsToCancel\.length\} 笔当前币挂单`\)/); - assert.match(planStatusBody, /`\$\{plan\.spec\.label\}计划:/); + assert.match(planStatusBody, /`\$\{plan\.spec\.label\}计划:比例 \$\{plan\.percent\}% · 笔数 \$\{levelText\} · 间距 \$\{plan\.ladderStep\}`/); + assert.doesNotMatch(planStatusBody, /%\/|\/幅/); assert.match(replacementStatusBody, /`\$\{plan\.spec\.label\}:/); assert.match(cancelPlanBody, /const setPlanStepStatus = \(message\) =>/); assert.doesNotMatch(cancelPlanBody, /setLadderStatus\(message\)/); From c9f7941db922a58c5add4ace12e83934af46b7f1 Mon Sep 17 00:00:00 2001 From: LiZhenhai-MBP14 <5935568+jackhai9@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:08:44 +0800 Subject: [PATCH 2/2] fix: keep ladder plan status compact --- scripts/binance-orderbook-trade.user.js | 4 ++-- src/binance-orderbook-trade/index.user.js | 6 +++--- test/unit/binance-orderbook-trade/ladder-options.test.js | 2 +- .../unit/binance-orderbook-trade/source-regressions.test.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/binance-orderbook-trade.user.js b/scripts/binance-orderbook-trade.user.js index 5745262..84ef243 100644 --- a/scripts/binance-orderbook-trade.user.js +++ b/scripts/binance-orderbook-trade.user.js @@ -5945,8 +5945,8 @@ } } function formatLadderPlanStatus(plan) { - const levelText = plan.levels === plan.requestedLevels ? `${plan.levels}` : `${plan.levels}/${plan.requestedLevels}`; - return `${plan.spec.label}计划:比例 ${plan.percent}% · 笔数 ${levelText} · 间距 ${plan.ladderStep}`; + const levelText = plan.levels === plan.requestedLevels ? `${plan.levels}档` : `${plan.levels}/${plan.requestedLevels}档`; + return `${plan.spec.label}计划:${plan.percent}% / ${levelText} / 幅${plan.ladderStep}`; } function isReplaceableCloseLadderOpenOrdersFailure(plan, error) { if (plan?.spec?.mode !== "CLOSE") return false; diff --git a/src/binance-orderbook-trade/index.user.js b/src/binance-orderbook-trade/index.user.js index 3ee19a1..f17ea73 100644 --- a/src/binance-orderbook-trade/index.user.js +++ b/src/binance-orderbook-trade/index.user.js @@ -4454,9 +4454,9 @@ import { function formatLadderPlanStatus(plan) { const levelText = plan.levels === plan.requestedLevels - ? `${plan.levels}` - : `${plan.levels}/${plan.requestedLevels}`; - return `${plan.spec.label}计划:比例 ${plan.percent}% · 笔数 ${levelText} · 间距 ${plan.ladderStep}`; + ? `${plan.levels}档` + : `${plan.levels}/${plan.requestedLevels}档`; + return `${plan.spec.label}计划:${plan.percent}% / ${levelText} / 幅${plan.ladderStep}`; } function isReplaceableCloseLadderOpenOrdersFailure(plan, error) { diff --git a/test/unit/binance-orderbook-trade/ladder-options.test.js b/test/unit/binance-orderbook-trade/ladder-options.test.js index f3dae2d..64ff0fc 100644 --- a/test/unit/binance-orderbook-trade/ladder-options.test.js +++ b/test/unit/binance-orderbook-trade/ladder-options.test.js @@ -224,7 +224,7 @@ test('ladder execution and UI updates use one captured mode-symbol-precision con assert.match(source, /const optionContext = getPanelOptionContext\(\)/); assert.match(source, /setLadderLevels\(value, optionContext\.mode, optionContext\.symbol, optionContext\.precision\)/); assert.match(source, /setLadderStep\(value, optionContext\.mode, optionContext\.symbol, optionContext\.precision\)/); - assert.match(source, /计划:比例 \$\{plan\.percent\}% · 笔数 \$\{levelText\} · 间距 \$\{plan\.ladderStep\}/); + assert.match(source, /计划:\$\{plan\.percent\}% \/ \$\{levelText\} \/ 幅\$\{plan\.ladderStep\}/); }); test('open and close ladder percentage rows share the centralized ratio label', () => { diff --git a/test/unit/binance-orderbook-trade/source-regressions.test.js b/test/unit/binance-orderbook-trade/source-regressions.test.js index 247e436..f61a8ba 100644 --- a/test/unit/binance-orderbook-trade/source-regressions.test.js +++ b/test/unit/binance-orderbook-trade/source-regressions.test.js @@ -833,7 +833,7 @@ test('ladder task statuses name the active action and observed outcome', () => { assert.match(startBody, /formatFailedLadderProgress\(spec\.label,\s*failureMessage,\s*progress\)/); assert.match(stopBody, /`\$\{activeSpec\.label\}停止中`/); assert.match(cancelPlanBody, /setPlanStepStatus\(`撤销 \$\{rowsToCancel\.length\} 笔当前币挂单`\)/); - assert.match(planStatusBody, /`\$\{plan\.spec\.label\}计划:比例 \$\{plan\.percent\}% · 笔数 \$\{levelText\} · 间距 \$\{plan\.ladderStep\}`/); + assert.match(planStatusBody, /`\$\{plan\.spec\.label\}计划:\$\{plan\.percent\}% \/ \$\{levelText\} \/ 幅\$\{plan\.ladderStep\}`/); assert.doesNotMatch(planStatusBody, /%\/|\/幅/); assert.match(replacementStatusBody, /`\$\{plan\.spec\.label\}:/); assert.match(cancelPlanBody, /const setPlanStepStatus = \(message\) =>/);