Skip to content

Commit

Permalink
Kraken: wsProcessOrderBook, the method was returning wrong bids data (t…
Browse files Browse the repository at this point in the history
…hrasher-corp#551)

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

* additional  map check to prevent panic

* linter issue fix

Co-authored-by: Vazha Bezhanishvili <[email protected]>
  • Loading branch information
vazha and Vazha Bezhanishvili authored Sep 11, 2020
1 parent 7eb052a commit 091ffae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions exchanges/kraken/kraken_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Binary file added go_build_github_com_thrasher_corp_gocryptotrader
Binary file not shown.

0 comments on commit 091ffae

Please sign in to comment.