From d30b22f0acfceef30d9e20c0c966f3dd3bdc0e41 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Wed, 25 Feb 2026 23:42:07 +0800 Subject: [PATCH] 1 --- backend/app/crypto_agent/crypto_agent.py | 27 ++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/backend/app/crypto_agent/crypto_agent.py b/backend/app/crypto_agent/crypto_agent.py index a0f99ba..d2d7b6f 100644 --- a/backend/app/crypto_agent/crypto_agent.py +++ b/backend/app/crypto_agent/crypto_agent.py @@ -994,22 +994,33 @@ class CryptoAgent: action_icon = '➖' 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_display = position_map.get(position_size, '🌱 轻仓') - # 构建卡片标题和颜色 + # 构建卡片标题和颜色 - 考虑入场方式 + # 挂单时标题显示"挂单",现价单时显示"开仓"/"平仓"等 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" 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" 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" 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" else: 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_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': price_display = f"💵 **入场价**: ${current_price:,.2f} (现价)"