bitmart优化完成
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user