fix: strategy only opens positions on its own configured symbol (V5.4)

This commit is contained in:
root 2026-03-12 13:19:29 +00:00
parent cb34b1cb39
commit 07bf1a8a58

View File

@ -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: