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

This commit is contained in:
guopengfa
2026-01-16 13:14:21 +08:00
parent 0146a54851
commit 38d38ce162
2 changed files with 4 additions and 1 deletions
@@ -591,7 +591,8 @@ class TradingExecutor:
# 初始化阶段:获取历史K线并计算指标
# ============================================
# logger.info(f"策略 {strategy_id} 初始化:获取历史K线数据...")
klines = self._fetch_latest_kline(symbol, timeframe, limit=6000)
history_limit = 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")
return