This commit is contained in:
aaron 2026-02-24 21:21:31 +08:00
parent 265e9d39c8
commit ed8d6be496
3 changed files with 49 additions and 20 deletions

View File

@ -984,12 +984,26 @@ 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} (现价)"
else:
entry_price = best_signal.get('entry_zone', current_price) if best_signal else current_price
price_display = f"💵 **挂单价**: ${entry_price:,.2f} (等待)"
content_parts = [
f"{action_icon} **操作**: {decision_text} ({action_text})",
f"{entry_type_icon} **入场方式**: {entry_type_text}",
f"{position_display.replace(' ', ': **')} | 📈 信心度: **{confidence}%**",
f"",
f"💰 **持仓价值**: {position_value_display}",
f"💵 **入场价**: ${current_price:,.2f}",
price_display,
]
if stop_loss:
@ -997,14 +1011,12 @@ class CryptoAgent:
if take_profit:
content_parts.append(f"🎯 **止盈价**: ${take_profit}")
# 简洁的决策理由和风险分析各1句话
content_parts.append(f"")
content_parts.append(f"📝 **决策理由**:")
content_parts.append(f"{reasoning}")
content_parts.append(f"📝 **决策**: {reasoning}")
if risk_analysis:
content_parts.append(f"")
content_parts.append(f"⚠️ **风险分析**:")
content_parts.append(f"{risk_analysis}")
content_parts.append(f"⚠️ **风险**: {risk_analysis}")
content_parts.append(f"")
content_parts.append(f"💼 模拟交易已执行")

View File

@ -136,8 +136,8 @@ class TradingDecisionMaker:
"position_size": "heavy/medium/light",
"quantity": 1200,
"confidence": 0-100,
"reasoning": "决策理由",
"risk_analysis": "风险分析",
"reasoning": "简洁的决策理由1句话15字以内",
"risk_analysis": "核心风险点1句话15字以内",
"stop_loss": 65500,
"take_profit": 67500,
"notes": "其他说明"
@ -151,12 +151,20 @@ class TradingDecisionMaker:
- **position_size** **quantity** 必须匹配heavy 对应最大保证金金额
- **入场方式由市场信号决定**你只需要根据市场信号的 `entry_type` 来执行交易
## 输出简洁性要求(重要!)
- **reasoning决策理由**用1句话说清楚决策原因不超过15个字
- 错误示例"由于市场信号显示强劲的上升趋势,且当前可用杠杆空间充足,因此决定开仓做多"
- 正确示例"A级信号上升趋势明确空间充足"
- **risk_analysis风险分析**用1句话指出核心风险不超过15个字
- 错误示例"需要注意市场波动性增加可能带来的潜在亏损风险,同时关注止损位的设置"
- 正确示例"关注波动风险,止损设好"
## 注意事项
1. **安全第一**宁可错过机会也不要冒过大风险
2. **遵守杠杆限制**总杠杆永远不超过 20
3. **理性决策**不要被 FOMO 情绪左右
4. **灵活应变**根据市场变化调整策略
5. **记录决策**清晰记录决策理由便于复盘
5. **简洁输出**决策理由和风险分析必须简明扼要
记住你是交易执行者不是市场分析师市场分析已经完成了你只需要根据分析结果和当前状态做出理性的交易决策
"""

View File

@ -189,22 +189,31 @@ async def price_monitor_loop():
# 处理挂单成交事件
if event_type == 'order_filled':
side_text = "做多" if result.get('side') == 'long' else "做空"
side_icon = '🟢' if result.get('side') == 'long' else '🔴'
grade = result.get('signal_grade', 'N/A')
message = f"""✅ 挂单成交
title = f"✅ 挂单成交 - {result.get('symbol')}"
交易对: {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}"""
content_parts = [
f"{side_icon} **方向**: {side_text}",
f"",
f"⭐ **信号等级**: {grade}",
f"",
f"💰 **挂单价**: ${result.get('entry_price', 0):,.2f}",
f"🎯 **成交价**: ${result.get('filled_price', 0):,.2f}",
f"📊 **持仓价值**: ${result.get('quantity', 0):,.0f}",
f"",
f"🛑 **止损价**: ${result.get('stop_loss', 0):,.2f}",
f"🎯 **止盈价**: ${result.get('take_profit', 0):,.2f}"
]
content = "\n".join(content_parts)
# 发送通知
await feishu.send_text(message)
await telegram.send_message(message)
await feishu.send_card(title, content, "blue")
if telegram:
message = f"{title}\n\n{content}"
await telegram.send_message(message)
logger.info(f"后台监控触发挂单成交: {result.get('order_id')} | {symbol}")
continue