diff --git a/backend/signal_engine.py b/backend/signal_engine.py index e795b65..7f6eab1 100644 --- a/backend/signal_engine.py +++ b/backend/signal_engine.py @@ -665,6 +665,7 @@ def main(): last_1m_save = {} cycle = 0 + warmup_cycles = 3 # 启动后跳过前3轮(45秒),避免冷启动信号开仓 while True: try: @@ -687,8 +688,8 @@ def main(): if result.get("signal"): logger.info(f"[{sym}] 🚨 信号: {result['signal']} score={result['score']} price={result['price']:.1f}") - # 模拟盘开仓(需开关开启) - if PAPER_TRADING_ENABLED: + # 模拟盘开仓(需开关开启 + 跳过冷启动) + if PAPER_TRADING_ENABLED and warmup_cycles <= 0: existing_dir = paper_get_active_direction(sym) new_dir = result["signal"] @@ -710,6 +711,10 @@ def main(): # 模拟盘持仓检查由paper_monitor.py通过WebSocket实时处理,这里不再检查 cycle += 1 + if warmup_cycles > 0: + warmup_cycles -= 1 + if warmup_cycles == 0: + logger.info("冷启动保护期结束,模拟盘开仓已启用") if cycle % 60 == 0: for sym, state in states.items(): logger.info(