This commit is contained in:
aaron 2026-02-25 23:42:07 +08:00
parent 3729b2de1e
commit d30b22f0ac

View File

@ -994,22 +994,33 @@ class CryptoAgent:
action_icon = '' action_icon = ''
action_text = action action_text = action
# 从市场信号中获取入场方式(需要在构建标题之前)
best_signal = self._get_best_signal_from_market(market_signal)
entry_type = best_signal.get('entry_type', 'market') if best_signal else 'market'
entry_type_text = '现价单' if entry_type == 'market' else '挂单'
entry_type_icon = '' if entry_type == 'market' else ''
# 仓位图标 # 仓位图标
position_map = {'heavy': '🔥 重仓', 'medium': '📊 中仓', 'light': '🌱 轻仓'} position_map = {'heavy': '🔥 重仓', 'medium': '📊 中仓', 'light': '🌱 轻仓'}
position_display = position_map.get(position_size, '🌱 轻仓') position_display = position_map.get(position_size, '🌱 轻仓')
# 构建卡片标题和颜色 # 构建卡片标题和颜色 - 考虑入场方式
# 挂单时标题显示"挂单",现价单时显示"开仓"/"平仓"等
if decision_type == 'OPEN': if decision_type == 'OPEN':
title = f"{account_type} {symbol} {decision_text}" decision_title = '挂单' if entry_type == 'limit' else '开仓'
title = f"{account_type} {symbol} {decision_title}"
color = "green" color = "green"
elif decision_type == 'CLOSE': elif decision_type == 'CLOSE':
title = f"{account_type} {symbol} {decision_text}" decision_title = '挂单' if entry_type == 'limit' else '平仓'
title = f"{account_type} {symbol} {decision_title}"
color = "orange" color = "orange"
elif decision_type == 'ADD': elif decision_type == 'ADD':
title = f"{account_type} {symbol} {decision_text}" decision_title = '挂单' if entry_type == 'limit' else '加仓'
title = f"{account_type} {symbol} {decision_title}"
color = "green" color = "green"
elif decision_type == 'REDUCE': elif decision_type == 'REDUCE':
title = f"{account_type} {symbol} {decision_text}" decision_title = '挂单' if entry_type == 'limit' else '减仓'
title = f"{account_type} {symbol} {decision_title}"
color = "orange" color = "orange"
else: else:
title = f"{account_type} {symbol} 交易执行" title = f"{account_type} {symbol} 交易执行"
@ -1022,12 +1033,6 @@ class CryptoAgent:
position_value = margin * leverage if isinstance(margin, (int, float)) else 'N/A' position_value = margin * leverage if isinstance(margin, (int, float)) else 'N/A'
position_value_display = f"${position_value:,.2f}" if isinstance(position_value, (int, float)) else "N/A" position_value_display = f"${position_value:,.2f}" if isinstance(position_value, (int, float)) else "N/A"
# 从市场信号中获取入场方式
best_signal = self._get_best_signal_from_market(market_signal)
entry_type = best_signal.get('entry_type', 'market') if best_signal else 'market'
entry_type_text = '现价单' if entry_type == 'market' else '挂单等待'
entry_type_icon = '' if entry_type == 'market' else ''
# 根据入场方式显示不同的价格信息 # 根据入场方式显示不同的价格信息
if entry_type == 'market': if entry_type == 'market':
price_display = f"💵 **入场价**: ${current_price:,.2f} (现价)" price_display = f"💵 **入场价**: ${current_price:,.2f} (现价)"