bitmart优化完成

This commit is contained in:
Administrator
2025-12-22 11:07:50 +08:00
parent b04a1da4c3
commit 4396e49e42
8 changed files with 559 additions and 253 deletions

View File

@@ -558,9 +558,9 @@ class MessageSender:
legacy_direction = position_data.get('legacyOrderDirection', '')
# 确定方向
if position_side == 'SHORT' or legacy_direction == 'OPEN_SHORT':
if legacy_direction == 'OPEN_SHORT':
direction = ""
elif position_side == 'LONG' or legacy_direction == 'OPEN_LONG':
elif legacy_direction == 'OPEN_LONG':
direction = ""
else:
direction = ""
@@ -575,23 +575,31 @@ class MessageSender:
pnl_rate = (open_avg_price - current_price) / open_avg_price * 100
pnl_str = f"{unrealized_pnl:+.2f} USDT ({pnl_rate:+.2f}%)"
# 当前持仓名义价值
current_value = fill_size * current_price
return (
"**【WEEX ETHUSDT 永续持仓监控】**\n\n"
f"**持仓方向**{direction}\n"
f"**当前现价**{current_price:.2f} USDT\n"
f"**开仓均价**{open_avg_price:.2f} USDT\n"
f"**持仓数量(eth)**{fill_size:.3f} ETH\n"
f"**持仓数量(usdt)**{fill_value / 100:.2f} USDT\n"
f"**名义价值**{current_value:.2f} USDT\n"
f"**浮动盈亏**{pnl_str}\n"
f"**账户可用余额**{available_balance:.2f} USDT"
)
else:
pnl_str = "0.00 USDT"
# 当前持仓名义价值
current_value = fill_size * current_price
return (
"**【WEEX ETHUSDT 永续持仓监控】**\n\n"
f"**持仓方向**{direction}\n"
f"**持仓方向**\n"
f"**当前现价**{current_price:.2f} USDT\n"
f"**开仓均价**{open_avg_price:.2f} USDT\n"
f"**持仓数量(eth)**{fill_size:.3f} ETH\n"
f"**持仓数量(usdt)**{fill_value / 100:.2f} USDT\n"
f"**名义价值**{current_value:.2f} USDT\n"
f"**浮动盈亏**{pnl_str}\n"
f"**账户可用余额**{available_balance:.2f} USDT"
)
else:
return (
"**【WEEX ETHUSDT 永续持仓监控】**\n\n"