diff --git a/crypto_monitor_binance/app.py b/crypto_monitor_binance/app.py index 17b4cf5..120e318 100644 --- a/crypto_monitor_binance/app.py +++ b/crypto_monitor_binance/app.py @@ -1112,6 +1112,7 @@ EARLY_EXIT_TRIGGERS = ( "保本止盈", "移动止盈", TIME_CLOSE_RESULT, + "强制清仓", "手动平仓", "止损", "其他", @@ -2593,7 +2594,7 @@ def calc_actual_rr(pnl_amount, risk_amount): r = float(risk_amount or 0) if r <= 0: return None - return round(float(pnl_amount or 0) / r, 4) + return round(float(pnl_amount or 0) / r, 2) except Exception: return None @@ -9210,7 +9211,7 @@ def add_journal(): pnl_hint = float(d.get("pnl") or 0) # 口径统一:实际RR = 实际盈亏 / 以损定仓对应的初始风险金额 if risk_amount_hint > 0: - real_rr_text = f"{(pnl_hint / risk_amount_hint):.4f}" + real_rr_text = f"{(pnl_hint / risk_amount_hint):.2f}" except Exception: pass diff --git a/crypto_monitor_gate/app.py b/crypto_monitor_gate/app.py index 36fca09..5e63b99 100644 --- a/crypto_monitor_gate/app.py +++ b/crypto_monitor_gate/app.py @@ -1099,6 +1099,7 @@ EARLY_EXIT_TRIGGERS = ( "保本止盈", "移动止盈", TIME_CLOSE_RESULT, + "强制清仓", "手动平仓", "止损", "其他", @@ -2310,7 +2311,7 @@ def calc_actual_rr(pnl_amount, risk_amount): r = float(risk_amount or 0) if r <= 0: return None - return round(float(pnl_amount or 0) / r, 4) + return round(float(pnl_amount or 0) / r, 2) except Exception: return None @@ -9073,7 +9074,7 @@ def add_journal(): pnl_hint = float(d.get("pnl") or 0) # 口径统一:实际RR = 实际盈亏 / 以损定仓对应的初始风险金额 if risk_amount_hint > 0: - real_rr_text = f"{(pnl_hint / risk_amount_hint):.4f}" + real_rr_text = f"{(pnl_hint / risk_amount_hint):.2f}" except Exception: pass diff --git a/crypto_monitor_okx/app.py b/crypto_monitor_okx/app.py index 7bc84d9..5f62a67 100644 --- a/crypto_monitor_okx/app.py +++ b/crypto_monitor_okx/app.py @@ -1102,6 +1102,7 @@ EARLY_EXIT_TRIGGERS = ( "保本止盈", "移动止盈", TIME_CLOSE_RESULT, + "强制清仓", "手动平仓", "止损", "其他", @@ -2204,7 +2205,7 @@ def calc_actual_rr(pnl_amount, risk_amount): r = float(risk_amount or 0) if r <= 0: return None - return round(float(pnl_amount or 0) / r, 4) + return round(float(pnl_amount or 0) / r, 2) except Exception: return None @@ -8593,7 +8594,7 @@ def add_journal(): pnl_hint = float(d.get("pnl") or 0) # 口径统一:实际RR = 实际盈亏 / 以损定仓对应的初始风险金额 if risk_amount_hint > 0: - real_rr_text = f"{(pnl_hint / risk_amount_hint):.4f}" + real_rr_text = f"{(pnl_hint / risk_amount_hint):.2f}" except Exception: pass diff --git a/lib/instance/templates/embed_boot_scripts.html b/lib/instance/templates/embed_boot_scripts.html index 938778f..bba2645 100644 --- a/lib/instance/templates/embed_boot_scripts.html +++ b/lib/instance/templates/embed_boot_scripts.html @@ -417,7 +417,7 @@ function setJournalField(name, value){ el.value = String(value); } -const EARLY_EXIT_TRIGGERS = new Set(["止盈","保本止盈","移动止盈","时间平仓","手动平仓","止损","其他"]); +const EARLY_EXIT_TRIGGERS = new Set(["止盈","保本止盈","移动止盈","时间平仓","强制清仓","手动平仓","止损","其他"]); const KEY_ENTRY_REASON_BY_SIGNAL = { "箱体突破": "关键位箱体突破", "收敛突破": "关键位收敛突破", @@ -552,7 +552,7 @@ function fillJournalFromTrade(t){ } } const er = String(t.result || "").trim(); - const exitTrigMap = { 止盈: "止盈", 保本止盈: "保本止盈", 移动止盈: "移动止盈", 时间平仓: "时间平仓", 手动平仓: "手动平仓", 止损: "止损" }; + const exitTrigMap = { 止盈: "止盈", 保本止盈: "保本止盈", 移动止盈: "移动止盈", 时间平仓: "时间平仓", 强制清仓: "强制清仓", 手动平仓: "手动平仓", 止损: "止损" }; if(exitTrigMap[er]) setJournalField("early_exit_trigger", exitTrigMap[er]); const note = `来自交易记录自动填充:${t.symbol || "-"} ${t.direction || "-"} | 入场:${entryPx || "-"} 止损:${slPx || "-"} 止盈:${tpPx || "-"} | 类型:${t.monitor_type || "-"}`; setJournalField("note", note); @@ -575,7 +575,7 @@ function recomputeJournalRealRr(){ const pnl = Number(String(pnlEl.value || "").trim()); const risk = Number(String(riskHint.value || "").trim()); if(Number.isFinite(pnl) && Number.isFinite(risk) && risk > 0){ - rrEl.value = (pnl / risk).toFixed(4); + rrEl.value = (pnl / risk).toFixed(2); } } diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index a60dfc7..efcf2b7 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -981,7 +981,7 @@ function setJournalField(name, value){ el.value = String(value); } -const EARLY_EXIT_TRIGGERS = new Set(["止盈","保本止盈","移动止盈","时间平仓","手动平仓","止损","其他"]); +const EARLY_EXIT_TRIGGERS = new Set(["止盈","保本止盈","移动止盈","时间平仓","强制清仓","手动平仓","止损","其他"]); const KEY_ENTRY_REASON_BY_SIGNAL = { "箱体突破": "关键位箱体突破", "收敛突破": "关键位收敛突破", @@ -1116,7 +1116,7 @@ function fillJournalFromTrade(t){ } } const er = String(t.result || "").trim(); - const exitTrigMap = { 止盈: "止盈", 保本止盈: "保本止盈", 移动止盈: "移动止盈", 时间平仓: "时间平仓", 手动平仓: "手动平仓", 止损: "止损" }; + const exitTrigMap = { 止盈: "止盈", 保本止盈: "保本止盈", 移动止盈: "移动止盈", 时间平仓: "时间平仓", 强制清仓: "强制清仓", 手动平仓: "手动平仓", 止损: "止损" }; if(exitTrigMap[er]) setJournalField("early_exit_trigger", exitTrigMap[er]); const note = `来自交易记录自动填充:${t.symbol || "-"} ${t.direction || "-"} | 入场:${entryPx || "-"} 止损:${slPx || "-"} 止盈:${tpPx || "-"} | 类型:${t.monitor_type || "-"}`; setJournalField("note", note); @@ -1139,7 +1139,7 @@ function recomputeJournalRealRr(){ const pnl = Number(String(pnlEl.value || "").trim()); const risk = Number(String(riskHint.value || "").trim()); if(Number.isFinite(pnl) && Number.isFinite(risk) && risk > 0){ - rrEl.value = (pnl / risk).toFixed(4); + rrEl.value = (pnl / risk).toFixed(2); } } diff --git a/lib/strategy/templates/journal_form_fields.html b/lib/strategy/templates/journal_form_fields.html index ff6e0c6..92f2be9 100644 --- a/lib/strategy/templates/journal_form_fields.html +++ b/lib/strategy/templates/journal_form_fields.html @@ -22,6 +22,7 @@ +