add config: get strategy history limit.(策略中的历史获取ticket数量可配置,当策略运行于分钟线的时候500条历史数据是不够的)

This commit is contained in:
guopengfa
2026-01-16 13:28:26 +08:00
parent 38d38ce162
commit f25b2ebbe3
@@ -591,7 +591,7 @@ class TradingExecutor:
# 初始化阶段:获取历史K线并计算指标
# ============================================
# logger.info(f"策略 {strategy_id} 初始化:获取历史K线数据...")
history_limit = os.getenv('K_LINE_HISTORY_GET_NUMBER', 500)
history_limit = int(os.getenv('K_LINE_HISTORY_GET_NUMBER', 500))
klines = self._fetch_latest_kline(symbol, timeframe, limit=history_limit)
if not klines or len(klines) < 2:
logger.error(f"Strategy {strategy_id} failed to fetch K-lines")