add config: get strategy history limit.(策略中的历史获取ticket数量可配置,当策略运行于分钟线的时候500条历史数据是不够的)
This commit is contained in:
@@ -591,7 +591,7 @@ class TradingExecutor:
|
|||||||
# 初始化阶段:获取历史K线并计算指标
|
# 初始化阶段:获取历史K线并计算指标
|
||||||
# ============================================
|
# ============================================
|
||||||
# logger.info(f"策略 {strategy_id} 初始化:获取历史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)
|
klines = self._fetch_latest_kline(symbol, timeframe, limit=history_limit)
|
||||||
if not klines or len(klines) < 2:
|
if not klines or len(klines) < 2:
|
||||||
logger.error(f"Strategy {strategy_id} failed to fetch K-lines")
|
logger.error(f"Strategy {strategy_id} failed to fetch K-lines")
|
||||||
|
|||||||
Reference in New Issue
Block a user