diff --git a/crypto_monitor_binance/app.py b/crypto_monitor_binance/app.py index d1f5206..290bff6 100644 --- a/crypto_monitor_binance/app.py +++ b/crypto_monitor_binance/app.py @@ -1120,28 +1120,16 @@ STATS_SEGMENT_DEFS = ( ("key_false_breakout", "关键位假突破", {"segment": "key_false_breakout"}), ("key_trigger", "关键位触价开仓", {"segment": "key_trigger"}), ) -# 复盘表单「其他」选项的 value(非入库值;自定义文本走 entry_reason_custom) -ENTRY_REASON_OTHER = "__OTHER__" - - def normalize_entry_reason(raw, custom_text=None): v = str(raw or "").strip() - if v == ENTRY_REASON_OTHER: - c = str(custom_text or "").strip() - return c[:2000] if c else "" return v if v in ENTRY_REASON_OPTIONS else "" def entry_reason_valid_for_storage(s): - """允许五种固定整句、或自定义短文本(不含未解析的 __OTHER__ 占位)。""" t = str(s or "").strip() if not t: return True - if t == ENTRY_REASON_OTHER: - return False - if t in ENTRY_REASON_OPTIONS: - return True - return 1 <= len(t) <= 2000 + return t in ENTRY_REASON_OPTIONS def normalize_early_exit_trigger(raw): @@ -7276,7 +7264,6 @@ def render_main_page(page="trade", embed_mode=None): trend_manual_count=trend_manual_entry_reason_count(TRADE_POLICY), ) ), - entry_reason_other_value=ENTRY_REASON_OTHER, key_auto_order_enabled=KEY_AUTO_ORDER_ENABLED, journal_chart_tf_choices=JOURNAL_CHART_TF_CHOICES, journal_chart_default_tf1=JOURNAL_CHART_DEFAULT_TF1, @@ -9115,9 +9102,9 @@ def del_order(id): @login_required def add_journal(): d = request.form - entry_reason_norm = normalize_entry_reason(d.get("entry_reason"), d.get("entry_reason_custom")) + entry_reason_norm = normalize_entry_reason(d.get("entry_reason")) if not entry_reason_norm: - flash("请选择开仓类型;若选「其他」请在下方填写自定义说明") + flash("请选择开仓类型") return _redirect_records() early_exit_trigger = normalize_early_exit_trigger(d.get("early_exit_trigger")) early_exit_note = str(d.get("early_exit_note") or "").strip() @@ -9495,7 +9482,7 @@ def api_trade_record_review_update(): if "reviewed_entry_reason" in payload: s = str(payload.get("reviewed_entry_reason") or "").strip() if s and not entry_reason_valid_for_storage(s): - return jsonify({"ok": False, "msg": "开仓类型须为五种固定整句之一、自定义说明(2000字内)或留空"}), 400 + return jsonify({"ok": False, "msg": "开仓类型须为下拉选项之一或留空"}), 400 reviewed_entry_reason_update = s or None conn = get_db() diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index 8bfa55d..067b438 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -570,12 +570,13 @@
- + {% for r in record %} {% set pnl_val = (r.pnl_amount or 0)|float %} + {% set stop_show = r.display_open_stop_loss or r.initial_stop_loss or r.stop_loss %} @@ -613,7 +614,8 @@ "closed_at": r.effective_closed_at, "pnl_amount": r.effective_pnl_amount, "result": r.effective_result, - "risk_amount": r.risk_amount + "risk_amount": r.risk_amount, + "effective_entry_reason": r.effective_entry_reason or "" }|tojson|safe }})' >填入复盘
品种类型方向成交止损(开仓)止盈基数杠杆持仓分钟开仓时间(北京)平仓时间(北京)盈亏U结果操作
品种类型开仓类型方向成交止损(开仓)止盈基数杠杆持仓分钟开仓时间(北京)平仓时间(北京)盈亏U结果操作
{{ r.symbol }} {{ r.monitor_type }}{% if r.key_signal_type %} · {{ r.key_signal_type }}{% endif %}{{ r.effective_entry_reason or '-' }} {{ '做多' if r.direction == 'long' else '做空' }} {{ price_fmt(r.symbol, r.trigger_price) }}