This commit is contained in:
aaron 2026-02-20 20:14:22 +08:00
parent 59a23bb5c1
commit 2749d50046
2 changed files with 38 additions and 2 deletions

View File

@ -1367,10 +1367,18 @@ class LLMSignalAnalyzer:
sl_percent = ((sl - entry) / entry * 100) if entry else 0 sl_percent = ((sl - entry) / entry * 100) if entry else 0
tp_percent = ((tp - 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 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} {action_icon} **方向**: {action}
{entry_type_icon} **入场**: {entry_type_text} {entry_type_icon} **入场**: {entry_type_text}

View File

@ -57,6 +57,31 @@ async def price_monitor_loop():
# 发送通知 # 发送通知
for result in triggered: for result in triggered:
status = result.get('status', '') 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) is_win = result.get('is_win', False)
if status == 'closed_tp': if status == 'closed_tp':
@ -65,6 +90,9 @@ async def price_monitor_loop():
elif status == 'closed_sl': elif status == 'closed_sl':
emoji = "🛑" emoji = "🛑"
status_text = "止损平仓" status_text = "止损平仓"
elif status == 'closed_be':
emoji = "🔒"
status_text = "保本止损"
else: else:
emoji = "📤" emoji = "📤"
status_text = "平仓" status_text = "平仓"