From 2a3d264c8f6dc17f2782bb1c0af298235759bcce Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 7 Jul 2026 01:01:57 +0800 Subject: [PATCH] fix: allow force-close in trade review and hide strategy nav for intraday MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统计核对结果允许强制清仓;日内户顶栏隐藏策略交易与策略交易记录。 Co-authored-by: Cursor --- crypto_monitor_binance/app.py | 4 ++-- crypto_monitor_gate/app.py | 4 ++-- crypto_monitor_okx/app.py | 4 ++-- lib/instance/templates/embed_boot_scripts.html | 2 +- lib/instance/templates/embed_shell.html | 2 ++ lib/instance/templates/index.html | 4 +++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/crypto_monitor_binance/app.py b/crypto_monitor_binance/app.py index 120e318..8700d90 100644 --- a/crypto_monitor_binance/app.py +++ b/crypto_monitor_binance/app.py @@ -1615,7 +1615,7 @@ TRADE_COMPLETED_RESULTS = ( TIME_CLOSE_RESULT, ) -REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", TIME_CLOSE_RESULT) +REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", "强制清仓", TIME_CLOSE_RESULT) def parse_dt_for_trading_day(s): @@ -9519,7 +9519,7 @@ def api_trade_record_review_update(): reviewed_pnl_raw = payload.get("reviewed_pnl_amount") if reviewed_result and reviewed_result not in REVIEW_RESULT_OPTIONS: - return jsonify({"ok": False, "msg": "结果仅允许:止盈/止损/保本止盈/移动止盈/手动平仓"}), 400 + return jsonify({"ok": False, "msg": "结果仅允许:" + "/".join(REVIEW_RESULT_OPTIONS)}), 400 try: reviewed_open_dt = datetime.strptime(reviewed_opened_at[:19], "%Y-%m-%d %H:%M:%S") diff --git a/crypto_monitor_gate/app.py b/crypto_monitor_gate/app.py index 5e63b99..17739ff 100644 --- a/crypto_monitor_gate/app.py +++ b/crypto_monitor_gate/app.py @@ -1609,7 +1609,7 @@ TRADE_COMPLETED_RESULTS = ( TIME_CLOSE_RESULT, ) -REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", TIME_CLOSE_RESULT) +REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", "强制清仓", TIME_CLOSE_RESULT) def parse_dt_for_trading_day(s): @@ -9382,7 +9382,7 @@ def api_trade_record_review_update(): reviewed_pnl_raw = payload.get("reviewed_pnl_amount") if reviewed_result and reviewed_result not in REVIEW_RESULT_OPTIONS: - return jsonify({"ok": False, "msg": "结果仅允许:止盈/止损/保本止盈/移动止盈/手动平仓"}), 400 + return jsonify({"ok": False, "msg": "结果仅允许:" + "/".join(REVIEW_RESULT_OPTIONS)}), 400 try: reviewed_open_dt = datetime.strptime(reviewed_opened_at[:19], "%Y-%m-%d %H:%M:%S") diff --git a/crypto_monitor_okx/app.py b/crypto_monitor_okx/app.py index 5f62a67..c953337 100644 --- a/crypto_monitor_okx/app.py +++ b/crypto_monitor_okx/app.py @@ -1594,7 +1594,7 @@ TRADE_COMPLETED_RESULTS = ( TIME_CLOSE_RESULT, ) -REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", TIME_CLOSE_RESULT) +REVIEW_RESULT_OPTIONS = ("止盈", "止损", "保本止盈", "移动止盈", "手动平仓", "强制清仓", TIME_CLOSE_RESULT) def parse_dt_for_trading_day(s): @@ -8902,7 +8902,7 @@ def api_trade_record_review_update(): reviewed_pnl_raw = payload.get("reviewed_pnl_amount") if reviewed_result and reviewed_result not in REVIEW_RESULT_OPTIONS: - return jsonify({"ok": False, "msg": "结果仅允许:止盈/止损/保本止盈/移动止盈/手动平仓"}), 400 + return jsonify({"ok": False, "msg": "结果仅允许:" + "/".join(REVIEW_RESULT_OPTIONS)}), 400 try: reviewed_open_dt = datetime.strptime(reviewed_opened_at[:19], "%Y-%m-%d %H:%M:%S") diff --git a/lib/instance/templates/embed_boot_scripts.html b/lib/instance/templates/embed_boot_scripts.html index bba2645..96c2de4 100644 --- a/lib/instance/templates/embed_boot_scripts.html +++ b/lib/instance/templates/embed_boot_scripts.html @@ -172,7 +172,7 @@ function editTradeRecordReview(t){ if(takeProfit === null) return; const pnl = prompt("最终盈亏(可手工核对后填写)", String(t.pnl_amount ?? "")); if(pnl === null) return; - const result = prompt("结果(止盈/止损/保本止盈/移动止盈/手动平仓/时间平仓)", String(t.result || "")); + const result = prompt("结果(止盈/止损/保本止盈/移动止盈/手动平仓/强制清仓/时间平仓)", String(t.result || "")); if(result === null) return; const note = prompt("备注(可空)", String(t.miss_reason || "")) ?? ""; pickEntryReason().then(function(entryIn){ diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index f703116..6a37618 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -50,8 +50,10 @@ diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index efcf2b7..f94dabd 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -75,8 +75,10 @@ @@ -736,7 +738,7 @@ function editTradeRecordReview(t){ if(takeProfit === null) return; const pnl = prompt("最终盈亏(可手工核对后填写)", String(t.pnl_amount ?? "")); if(pnl === null) return; - const result = prompt("结果(止盈/止损/保本止盈/移动止盈/手动平仓/时间平仓)", String(t.result || "")); + const result = prompt("结果(止盈/止损/保本止盈/移动止盈/手动平仓/强制清仓/时间平仓)", String(t.result || "")); if(result === null) return; const note = prompt("备注(可空)", String(t.miss_reason || "")) ?? ""; pickEntryReason().then(function(entryIn){