From a279e5f602ef0a916367ef25598ec0aa1014f39e Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Thu, 15 Aug 2024 17:50:55 +0700 Subject: [PATCH] fixup! Kraken: Sub Channel improvements --- exchanges/kraken/kraken_websocket.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exchanges/kraken/kraken_websocket.go b/exchanges/kraken/kraken_websocket.go index 7eb077ef18d..0154dd8d82d 100644 --- a/exchanges/kraken/kraken_websocket.go +++ b/exchanges/kraken/kraken_websocket.go @@ -450,8 +450,8 @@ func (k *Kraken) wsProcessTickers(response []any, pair currency.Pair) error { if !ok { return errors.New("received invalid ticker data") } - data := make([]float64, 9) - for i, b := range []byte("abcvlho") { // p and t skipped + data := map[string]float64{} + for _, b := range []byte("abcvlho") { // p and t skipped key := string(b) a, ok := t[key].([]any) if !ok { @@ -466,18 +466,18 @@ func (k *Kraken) wsProcessTickers(response []any, pair currency.Pair) error { if err != nil { return fmt.Errorf("received invalid ticker data: %w", err) } - data[i] = f + data[key] = f } k.Websocket.DataHandler <- &ticker.Price{ ExchangeName: k.Name, - Ask: data[0], - Bid: data[1], - Close: data[2], - Volume: data[3], - Low: data[6], - High: data[7], - Open: data[8], + Ask: data["a"], + Bid: data["b"], + Close: data["c"], + Volume: data["v"], + Low: data["l"], + High: data["h"], + Open: data["o"], AssetType: asset.Spot, Pair: pair, }