fix: allow force-close in trade review and hide strategy nav for intraday

统计核对结果允许强制清仓;日内户顶栏隐藏策略交易与策略交易记录。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 01:01:57 +08:00
parent 6745262412
commit 2a3d264c8f
6 changed files with 12 additions and 8 deletions
+2 -2
View File
@@ -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")
+2 -2
View File
@@ -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")
+2 -2
View File
@@ -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")
@@ -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){
+2
View File
@@ -50,8 +50,10 @@
<nav class="top-nav embed-top-nav" aria-label="实例导航">
<a href="/key_monitor" data-embed-tab="key_monitor" class="{% if initial_tab == 'key_monitor' %}active{% endif %}">关键位监控</a>
<a href="/trade" data-embed-tab="trade" class="{% if initial_tab == 'trade' %}active{% endif %}">实盘下单</a>
{% if not intraday_discipline %}
<a href="/strategy" data-embed-tab="strategy" class="{% if initial_tab == 'strategy' %}active{% endif %}">策略交易</a>
<a href="/strategy/records" data-embed-tab="strategy_records" class="{% if initial_tab == 'strategy_records' %}active{% endif %}">策略交易记录</a>
{% endif %}
<a href="/records" data-embed-tab="records" class="{% if initial_tab == 'records' %}active{% endif %}">交易记录与复盘</a>
<a href="/stats" data-embed-tab="stats" class="{% if initial_tab == 'stats' %}active{% endif %}">统计分析</a>
</nav>
+3 -1
View File
@@ -75,8 +75,10 @@
<div class="top-nav">
<a href="/key_monitor" class="{% if page == 'key_monitor' %}active{% endif %}">关键位监控</a>
<a href="/trade" class="{% if page == 'trade' %}active{% endif %}">实盘下单</a>
{% if not intraday_discipline %}
<a href="/strategy" class="{% if page in ('strategy', 'strategy_trend', 'strategy_roll') %}active{% endif %}">策略交易</a>
<a href="/strategy/records" class="{% if page == 'strategy_records' %}active{% endif %}">策略交易记录</a>
{% endif %}
<a href="/records" class="{% if page == 'records' %}active{% endif %}">交易记录与复盘</a>
<a href="/stats" class="{% if page == 'stats' %}active{% endif %}">统计分析</a>
</div>
@@ -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){