Kraken: wsProcessOrderBook, the method was returning wrong bids data (#551)

* Kraken - wsProcessOrderBook, the method was returning wrong bids data

* additional  map check to prevent panic

* linter issue fix

Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>
This commit is contained in:
Vazha
2020-09-11 14:36:08 +03:00
committed by GitHub
parent 7eb052ab84
commit 091ffae8df
2 changed files with 4 additions and 3 deletions

View File

@@ -605,9 +605,10 @@ func (k *Kraken) wsProcessTrades(channelData *WebsocketChannelData, data []inter
// wsProcessOrderBook determines if the orderbook data is partial or update
// Then sends to appropriate fun
func (k *Kraken) wsProcessOrderBook(channelData *WebsocketChannelData, data map[string]interface{}) error {
if fullAsk, ok := data["as"].([]interface{}); ok {
fullBids := data["as"].([]interface{})
err := k.wsProcessOrderBookPartial(channelData, fullAsk, fullBids)
askSnapshot, askSnapshotExists := data["as"].([]interface{})
bidSnapshot, bidSnapshotExists := data["bs"].([]interface{})
if askSnapshotExists || bidSnapshotExists {
err := k.wsProcessOrderBookPartial(channelData, askSnapshot, bidSnapshot)
if err != nil {
return err
}

Binary file not shown.