Fix embed date filter reload and classify profitable stops as trailing TP.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 11:27:42 +08:00
parent 924a385d6c
commit 2dadd93d91
9 changed files with 95 additions and 74 deletions
+18
View File
@@ -0,0 +1,18 @@
"""交易结果展示与入库时的语义归一化。"""
def normalize_result_with_pnl(result, pnl_amount):
"""
非手动平仓且实际盈利时,不应记为「止损」。
程序触发的止损类平仓若盈亏为正,归类为「移动止盈」。
"""
res = (result or "").strip()
if res == "手动平仓":
return res
if res == "止损":
try:
if float(pnl_amount or 0) > 0:
return "移动止盈"
except (TypeError, ValueError):
pass
return res