From 097f1cd756ced77605ce4cb23835617807f00698 Mon Sep 17 00:00:00 2001 From: Liu Xiang Qian Date: Sun, 2 Nov 2025 22:11:27 +0800 Subject: [PATCH] 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) }