Include LIVE close-fee estimate in target PnL; rest after manual and emergency close.

Align docs so LIVE exit matches SIM fee buffer; manual full close now enters rest_seconds like auto/emergency.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 22:58:10 +08:00
parent 16efa44ffb
commit 9d3b36826c
7 changed files with 51 additions and 7 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ def enrich_live_unrealized(
logger.warning("live unrealized exchange overlay failed: %s", e)
option_upl = float(base.get("option_upl") or 0.0) # 期权净盈亏(本地)
# 保守预估平仓费:按现有名义×费率×2 腿,避免「刚达标、扣费后不够」
# LIVE 达标口径:必须扣预估平仓手续费(与 SIM / 策略说明一致)
try:
from ..config import get_settings
@@ -89,7 +89,7 @@ def enrich_live_unrealized(
+ abs(float(base.get("option_qty_eth") or 0.0))
)
est_close = max(0.0, notional_est * fr * 2.0)
# 资金费 signed:付出为负,直接加总
# 资金费 signed:付出为负;再减估平仓费
net_pnl = perp_upl + option_upl - fees_paid + funding - est_close
out = dict(base)