From 2d50d9a990aad1cde434aa3ef49ba12a708ca892 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 8 Feb 2026 14:11:35 +0800 Subject: [PATCH] update --- backend/app/api/paper_trading.py | 23 +++++++++++------------ backend/app/config.py | 2 +- backend/app/crypto_agent/crypto_agent.py | 2 +- frontend/paper-trading.html | 9 +++++++++ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/backend/app/api/paper_trading.py b/backend/app/api/paper_trading.py index b40a385..8df622e 100644 --- a/backend/app/api/paper_trading.py +++ b/backend/app/api/paper_trading.py @@ -198,30 +198,29 @@ async def get_statistics_by_symbol(): async def get_monitor_status(): """获取价格监控状态和实时价格""" try: - monitor = get_price_monitor_service() - paper_trading = get_paper_trading_service() + from app.config import get_settings - # 获取活跃订单的交易对 - active_orders = paper_trading.get_active_orders() - symbols_needed = set(order.get('symbol') for order in active_orders if order.get('symbol')) + monitor = get_price_monitor_service() + settings = get_settings() + + # 始终显示配置的交易对价格 + configured_symbols = settings.crypto_symbols.split(',') # 获取价格 - 优先使用监控服务的缓存价格 latest_prices = dict(monitor.latest_prices) - # 如果监控服务没有价格数据,直接从 Binance 获取 - for symbol in symbols_needed: + # 获取所有配置的交易对价格 + for symbol in configured_symbols: + symbol = symbol.strip() if symbol not in latest_prices or latest_prices[symbol] is None: price = binance_service.get_current_price(symbol) if price: latest_prices[symbol] = price - # 注意:止盈止损检查由后台任务 (main.py price_monitor_loop) 处理 - # 这里只返回价格数据供前端显示 - return { "success": True, - "running": True, # 后台任务始终运行 - "subscribed_symbols": list(symbols_needed), + "running": True, + "subscribed_symbols": configured_symbols, "latest_prices": latest_prices } except Exception as e: diff --git a/backend/app/config.py b/backend/app/config.py index a850737..253b4ef 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -103,7 +103,7 @@ class Settings(BaseSettings): telegram_enabled: bool = True # 是否启用 Telegram 通知 # 加密货币交易智能体配置 - crypto_symbols: str = "BTCUSDT,ETHUSDT,BNBUSDT,SOLUSDT" # 监控的交易对,逗号分隔 + crypto_symbols: str = "BTCUSDT,ETHUSDT" # 监控的交易对,逗号分隔 crypto_analysis_interval: int = 60 # 分析间隔(秒) crypto_llm_threshold: float = 0.7 # 触发 LLM 分析的置信度阈值 diff --git a/backend/app/crypto_agent/crypto_agent.py b/backend/app/crypto_agent/crypto_agent.py index 88295e4..0d66106 100644 --- a/backend/app/crypto_agent/crypto_agent.py +++ b/backend/app/crypto_agent/crypto_agent.py @@ -352,7 +352,7 @@ class CryptoAgent: return False confidence = signal.get('confidence', 0) - if confidence < 50: + if confidence < 70: return False # 检查冷却时间(30分钟内不重复发送相同方向的信号) diff --git a/frontend/paper-trading.html b/frontend/paper-trading.html index c14852c..88570e8 100644 --- a/frontend/paper-trading.html +++ b/frontend/paper-trading.html @@ -6,6 +6,15 @@