From 097f1cd756ced77605ce4cb23835617807f00698 Mon Sep 17 00:00:00 2001 From: Liu Xiang Qian Date: Sun, 2 Nov 2025 22:11:27 +0800 Subject: [PATCH 1/2] fix: Correct 4h kline data storage in WebSocket monitor Fixed critical bug where 4h kline data was incorrectly stored with 3m kline data, causing data mismatch. Changes: - Changed `m.klineDataMap4h.Store(s, klines)` to `klines4h` - Updated log message to use `len(klines4h)` instead of `len(klines)` This bug would cause 4h kline queries to return 3m data, leading to incorrect technical indicator calculations. Fixes: #260 Related: #176 --- market/monitor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/market/monitor.go b/market/monitor.go index 337640d8..23e126d9 100644 --- a/market/monitor.go +++ b/market/monitor.go @@ -106,8 +106,8 @@ func (m *WSMonitor) initializeHistoricalData() error { return } if len(klines4h) > 0 { - m.klineDataMap4h.Store(s, klines) - log.Printf("已加载 %s 的历史K线数据-4h: %d 条", s, len(klines)) + m.klineDataMap4h.Store(s, klines4h) + log.Printf("已加载 %s 的历史K线数据-4h: %d 条", s, len(klines4h)) } }(symbol) } From c5628293a39f2d584005cb1e11097ddaa30b89b0 Mon Sep 17 00:00:00 2001 From: Liu Xiang Qian Date: Mon, 3 Nov 2025 21:52:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91?= =?UTF-8?q?=20Trader=20=E6=97=B6=20AI=20=E6=A8=A1=E5=9E=8B=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20##=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=8F=8F=E8=BF=B0=20=E7=BC=96=E8=BE=91=20Tra?= =?UTF-8?q?der=20=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=8F=90=E7=A4=BA"AI=E6=A8=A1=E5=9E=8B=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=88=96=E6=9C=AA=E5=90=AF=E7=94=A8?= =?UTF-8?q?"=E9=94=99=E8=AF=AF=E3=80=82=20##=20=E6=A0=B9=E6=9C=AC=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=20-=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9E=8B=20ID=20=E6=98=AF=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=88=E5=A6=82=20`admin=5Fdeepseek`?= =?UTF-8?q?=EF=BC=89=20-=20API=20=E8=BF=94=E5=9B=9E=E6=97=B6=E5=B0=86?= =?UTF-8?q?=E5=85=B6=E8=BD=AC=E6=8D=A2=E4=B8=BA=20provider=20=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=EF=BC=88`deepseek`=EF=BC=89=20-=20=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=20enabledModels=20=E5=88=97=E8=A1=A8=E4=B8=AD=E6=98=AF?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=20ID=20-=20=E5=AF=BC=E8=87=B4=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E7=94=A8=20`deepseek`=20=E6=9F=A5=E6=89=BE=20`admin?= =?UTF-8?q?=5Fdeepseek`=20=E6=97=B6=E5=A4=B1=E8=B4=A5=20##=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=96=B9=E6=A1=88=20=E7=A7=BB=E9=99=A4=20handleGetTra?= =?UTF-8?q?derConfig=20=E4=B8=AD=E7=9A=84=E6=A8=A1=E5=9E=8B=20ID=20?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E9=80=BB=E8=BE=91=EF=BC=8C=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AE=8C=E6=95=B4=E7=9A=84=E6=A8=A1=E5=9E=8B=20ID?= =?UTF-8?q?=EF=BC=8C=E4=BF=9D=E6=8C=81=E4=B8=8E=E5=89=8D=E7=AB=AF=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=88=97=E8=A1=A8=E6=A0=BC=E5=BC=8F=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E3=80=82=20Fixes=20#335?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/server.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/api/server.go b/api/server.go index ad16470a..92270715 100644 --- a/api/server.go +++ b/api/server.go @@ -801,14 +801,8 @@ func (s *Server) handleGetTraderConfig(c *gin.Context) { } } - // AIModelID 应该已经是 provider(如 "deepseek"),直接使用 - // 如果是旧数据格式(如 "admin_deepseek"),提取 provider 部分 + // 返回完整的模型ID,不做转换,保持与前端模型列表一致 aiModelID := traderConfig.AIModelID - // 兼容旧数据:如果包含下划线,提取最后一部分作为 provider - if strings.Contains(aiModelID, "_") { - parts := strings.Split(aiModelID, "_") - aiModelID = parts[len(parts)-1] - } result := map[string]interface{}{ "trader_id": traderConfig.ID,