diff --git a/backend_api_python/app/services/trading_executor.py b/backend_api_python/app/services/trading_executor.py index abbcce4..1acbc1f 100644 --- a/backend_api_python/app/services/trading_executor.py +++ b/backend_api_python/app/services/trading_executor.py @@ -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 diff --git a/backend_api_python/env.example b/backend_api_python/env.example index b4eaf0f..8fca97c 100644 --- a/backend_api_python/env.example +++ b/backend_api_python/env.example @@ -286,3 +286,5 @@ CREDITS_REGISTER_BONUS=100 # Referral bonus credits (邀请用户赠送积分,邀请人获得) CREDITS_REFERRAL_BONUS=50 +# History K-Line ticket get number (策略中默认获取历史K线数量) +K_LINE_HISTORY_GET_NUMBER=500