From adde474c99355211e2c7b94411b8f3940caa0181 Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Tue, 13 Feb 2024 19:54:26 +0700 Subject: [PATCH] fixup! Kraken: Handling for Pairs --- exchanges/kraken/kraken_websocket.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exchanges/kraken/kraken_websocket.go b/exchanges/kraken/kraken_websocket.go index 19baef4eca4..db935893974 100644 --- a/exchanges/kraken/kraken_websocket.go +++ b/exchanges/kraken/kraken_websocket.go @@ -973,14 +973,19 @@ func (k *Kraken) wsProcessCandles(channelName string, response []any, pair curre return fmt.Errorf("%w: %s %s %s", stream.ErrSubscriptionNotFound, asset.Spot, channelName, pair) } - dataStr, ok := response[1].([]string) // 8 string quoted floats followed by 1 integer for trade count + dataStr, ok := response[1].([]any) if !ok || len(dataStr) != 9 { return errors.New("received invalid candle data") } data := make([]float64, 8) for i := 0; i < 8; i++ { - f, err := strconv.ParseFloat(dataStr[i], 64) + s, ok := dataStr[i].(string) + if !ok { + return fmt.Errorf("received invalid candle data: %w", common.GetTypeAssertError("string", dataStr[i], "candle-data")) + } + + f, err := strconv.ParseFloat(s, 64) if err != nil { return fmt.Errorf("received invalid candle data: %w", err) }