feat: add force-close exit trigger and round journal real RR to 2dp

复盘离场触发增加强制清仓;填入复盘与自动计算实际盈亏比保留两位小数。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-07 00:40:55 +08:00
parent 1092816359
commit 5a0d18cf99
6 changed files with 16 additions and 12 deletions
+3 -2
View File
@@ -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