From 38d38ce1623bb3b043987ffab5ff72a4fec2c803 Mon Sep 17 00:00:00 2001 From: guopengfa Date: Fri, 16 Jan 2026 13:14:21 +0800 Subject: [PATCH] =?UTF-8?q?add=20config:=20get=20strategy=20history=20limi?= =?UTF-8?q?t.=EF=BC=88=E7=AD=96=E7=95=A5=E4=B8=AD=E7=9A=84=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=8E=B7=E5=8F=96ticket=E6=95=B0=E9=87=8F=E5=8F=AF?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=BD=93=E7=AD=96=E7=95=A5=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E4=BA=8E=E5=88=86=E9=92=9F=E7=BA=BF=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99500=E6=9D=A1=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=98=AF=E4=B8=8D=E5=A4=9F=E7=9A=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend_api_python/app/services/trading_executor.py | 3 ++- backend_api_python/env.example | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) 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