From 2749d50046bcc227256aab26cf6bbb4100d434e1 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Fri, 20 Feb 2026 20:14:22 +0800 Subject: [PATCH] update --- .../app/crypto_agent/llm_signal_analyzer.py | 12 ++++++-- backend/app/main.py | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/backend/app/crypto_agent/llm_signal_analyzer.py b/backend/app/crypto_agent/llm_signal_analyzer.py index d51ed2f..5b64d5e 100644 --- a/backend/app/crypto_agent/llm_signal_analyzer.py +++ b/backend/app/crypto_agent/llm_signal_analyzer.py @@ -1367,10 +1367,18 @@ class LLMSignalAnalyzer: sl_percent = ((sl - entry) / entry * 100) if entry else 0 tp_percent = ((tp - entry) / entry * 100) if entry else 0 - # 构建标题(带股票名称) + # 识别市场类型 + if self.agent_type == 'crypto': + market_tag = '[加密货币] ' + elif symbol.endswith('.HK'): + market_tag = '[港股] ' + else: + market_tag = '[美股] ' + + # 构建标题(带股票名称和市场类型) symbol_display = f"{stock_name}({symbol})" if stock_name else symbol - message = f"""📊 {symbol_display} {signal_type}信号 + message = f"""📊 {market_tag}{symbol_display} {signal_type}信号 {action_icon} **方向**: {action} {entry_type_icon} **入场**: {entry_type_text} diff --git a/backend/app/main.py b/backend/app/main.py index 574a386..3d44239 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -57,6 +57,31 @@ async def price_monitor_loop(): # 发送通知 for result in triggered: status = result.get('status', '') + event_type = result.get('event_type', 'order_closed') + + # 处理挂单成交事件 + if event_type == 'order_filled': + side_text = "做多" if result.get('side') == 'long' else "做空" + grade = result.get('signal_grade', 'N/A') + + message = f"""✅ 挂单成交 + +交易对: {result.get('symbol')} +方向: {side_text} +等级: {grade} +挂单价: ${result.get('entry_price', 0):,.2f} +成交价: ${result.get('filled_price', 0):,.2f} +仓位: ${result.get('quantity', 0):,.0f} +止损: ${result.get('stop_loss', 0):,.2f} +止盈: ${result.get('take_profit', 0):,.2f}""" + + # 发送通知 + await feishu.send_text(message) + await telegram.send_message(message) + logger.info(f"后台监控触发挂单成交: {result.get('order_id')} | {symbol}") + continue + + # 处理订单平仓事件 is_win = result.get('is_win', False) if status == 'closed_tp': @@ -65,6 +90,9 @@ async def price_monitor_loop(): elif status == 'closed_sl': emoji = "🛑" status_text = "止损平仓" + elif status == 'closed_be': + emoji = "🔒" + status_text = "保本止损" else: emoji = "📤" status_text = "平仓"