okx-auto-position: 平仓推送删 unrealizedPnl 字段 (改用 fillPnl/不显示)

**Bug**: 平仓推送显示 unrealizedPnl (浮盈) + 不扣手续费
**实际**: 用户从 OKX app 看真盈亏 (-1.9 vs 推送 +2.96 不一致)

**Fix**:
1. okx_position_advisor.py close_position() 用 fillPnl (OKX 真成交字段) 替换 unrealizedPnl
2. format_close_result() 删 '盈亏: X USDT' 字段
3. format_close_message() 删 '浮盈' 字段
4. 平仓推送加 '💡 实际盈亏请到 OKX app 查看 (扣手续费 + funding)' 提示

**保留**:
- format_execution_result() 开仓前预测盈利额 (TP/SL 推算的合理预估)
- record_confirmed 表的 pnl 字段 (历史归档)

预期: 用户平仓时推送不带误导性'X USDT 浮盈', 改从 OKX app 自己看真盈亏
This commit is contained in:
2026-08-05 13:58:03 +08:00
parent f00b6962e2
commit 0fd498c2c3
2 changed files with 22 additions and 11 deletions
+5 -5
View File
@@ -578,17 +578,17 @@ def format_close_message(fields, close_result):
if action == 'closed':
pos = close_result['pos_before']
u = pos['upl']
u_emoji = '🔥' if u >= 0 else '🔴'
u_sign = '+' if u >= 0 else ''
# 2026-08-05: 不显示浮盈 (unrealizedPnl 不准, 用户从 OKX app 看真盈亏)
return f"""✅ {symbol} {side_cn} {emoji} {leverage}x 已市价全平 | {trader}
{pos['side']} {pos['pos']}张 | 浮盈 {u_sign}{u:.2f} USDT {u_emoji}"""
{pos['side']} {pos['pos']}张
💡 实际盈亏请到 OKX app 查看 (扣手续费 + funding)"""
elif action == 'skip':
pos = close_result['pos_before']
return f"""⏭️ {symbol} 平仓信号跳过 | {trader}
你有反向持仓 {pos['side']} {pos['pos']}张 @ {pos['avgPx']:.2f} (浮盈 {pos['upl']:+.2f})"""
你有反向持仓 {pos['side']} {pos['pos']}张 @ {pos['avgPx']:.2f}
💡 实际盈亏请到 OKX app 查看 (扣手续费 + funding)"""
elif action == 'none':
return f"""ℹ️ {symbol} {side_cn} 平仓信号 | {trader}