From 07bf1a8a580b5cfad8e45bef484d8efd4683c64e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 12 Mar 2026 13:19:29 +0000 Subject: [PATCH] fix: strategy only opens positions on its own configured symbol (V5.4) --- backend/signal_engine.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/signal_engine.py b/backend/signal_engine.py index bab8d82..0537c1a 100644 --- a/backend/signal_engine.py +++ b/backend/signal_engine.py @@ -1580,6 +1580,10 @@ def main(): strategy_name = strategy_cfg.get("name", "v51_baseline") if not is_strategy_enabled(strategy_name): continue + # V5.4: custom策略只处理自己配置的symbol + strategy_symbol = strategy_cfg.get("symbol", "") + if strategy_symbol and strategy_symbol != sym: + continue eval_dir = result.get("direction") existing_dir = paper_get_active_direction(sym, strategy_name) if existing_dir and eval_dir and existing_dir != eval_dir and result["score"] >= 75: @@ -1598,6 +1602,10 @@ def main(): ) # 模拟盘开仓(需该策略启用 + 跳过冷启动) if is_strategy_enabled(strategy_name) and warmup_cycles <= 0: + # V5.4: custom策略只在自己配置的symbol上开仓 + strategy_symbol = strategy_cfg.get("symbol", "") + if strategy_symbol and strategy_symbol != sym: + continue # 跳过不属于该策略的币种 if not paper_has_active_position(sym, strategy_name): active_count = paper_active_count(strategy_name) if active_count < PAPER_MAX_POSITIONS: