This commit is contained in:
aaron 2026-02-06 01:38:15 +08:00
parent 5ab8e7589c
commit 56c0eb1357
2 changed files with 61 additions and 4 deletions

View File

@ -837,8 +837,14 @@ class SignalAnalyzer:
confidence = min(30 + signal_weights['buy'] * 8, 80) confidence = min(30 + signal_weights['buy'] * 8, 80)
reasons = buy_signals + ["主升浪追多"] reasons = buy_signals + ["主升浪追多"]
signal_grade = 'B' if confidence >= 60 else 'C' signal_grade = 'B' if confidence >= 60 else 'C'
elif trend_phase in ['oversold', 'overbought']: elif trend_phase == 'oversold' and signal_weights['buy'] >= 3:
reasons = ['极端行情,等待企稳'] # 极度超卖时允许抄底,但降低置信度并提示风险
action = 'buy'
confidence = min(30 + signal_weights['buy'] * 8, 70) # 最高70%
reasons = buy_signals + ["⚠️ 极度超卖抄底(高风险)", "建议轻仓试探"]
signal_grade = 'C' # 最高C级
elif trend_phase == 'overbought':
reasons = ['极度超买,不宜追多']
elif trend_direction == 'bearish': elif trend_direction == 'bearish':
if trend_phase == 'correction' and signal_weights['sell'] >= 3: if trend_phase == 'correction' and signal_weights['sell'] >= 3:
@ -851,8 +857,14 @@ class SignalAnalyzer:
confidence = min(30 + signal_weights['sell'] * 8, 80) confidence = min(30 + signal_weights['sell'] * 8, 80)
reasons = sell_signals + ["主跌浪追空"] reasons = sell_signals + ["主跌浪追空"]
signal_grade = 'B' if confidence >= 60 else 'C' signal_grade = 'B' if confidence >= 60 else 'C'
elif trend_phase in ['oversold', 'overbought']: elif trend_phase == 'overbought' and signal_weights['sell'] >= 3:
reasons = ['极端行情,等待企稳'] # 极度超买时允许做空,但降低置信度并提示风险
action = 'sell'
confidence = min(30 + signal_weights['sell'] * 8, 70) # 最高70%
reasons = sell_signals + ["⚠️ 极度超买摸顶(高风险)", "建议轻仓试探"]
signal_grade = 'C' # 最高C级
elif trend_phase == 'oversold':
reasons = ['极度超卖,不宜追空']
else: # neutral else: # neutral
reasons = ['趋势不明确,观望'] reasons = ['趋势不明确,观望']

45
backend/run_crypto_once.py Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""
手动执行一次加密货币分析
用法: python run_crypto_once.py [symbol]
示例: python run_crypto_once.py BTCUSDT
"""
import asyncio
import sys
# 添加项目路径
sys.path.insert(0, '/Users/aaron/source_code/Stock_Agent/backend')
from app.crypto_agent.crypto_agent import CryptoAgent
async def main():
# 获取要分析的交易对
if len(sys.argv) > 1:
symbols = sys.argv[1:]
else:
# 默认分析所有配置的交易对
from app.config import get_settings
settings = get_settings()
symbols = settings.crypto_symbols.split(',')
print(f"\n{'=' * 60}")
print(f"手动执行加密货币分析")
print(f"{'=' * 60}")
print(f"分析交易对: {', '.join(symbols)}")
print(f"{'=' * 60}\n")
# 创建智能体实例
agent = CryptoAgent()
# 分析每个交易对
for symbol in symbols:
await agent.analyze_symbol(symbol.strip().upper())
print(f"\n{'=' * 60}")
print(f"分析完成")
print(f"{'=' * 60}\n")
if __name__ == '__main__':
asyncio.run(main())