Bitstamp: Fix websocket orderbook snapshot blanking LastUpdate (#1319)

* Bitstamp: Fix orderbook snapshot blanking LastUpdate

Drive-By: Remove:
`Bitstamp BTC/USDT spot orderbook has zero bid price, filtering.`
It's unactionable and happens every snapshot right now

* Bitstamp: Use ob timestamps for LastUpdate

Obviously.
This commit is contained in:
Gareth Kirwan
2023-08-15 05:22:40 +01:00
committed by GitHub
parent 8fc4ca9b11
commit 4cfa6c4396
3 changed files with 3 additions and 4 deletions

View File

@@ -19,7 +19,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
"github.com/thrasher-corp/gocryptotrader/log"
)
const (
@@ -665,6 +664,5 @@ func filterOrderbookZeroBidPrice(ob *orderbook.Base) {
return
}
log.Warnf(log.ExchangeSys, "%s %s %s orderbook has zero bid price, filtering.", ob.Exchange, ob.Pair, ob.Asset)
ob.Bids = ob.Bids[0 : len(ob.Bids)-1]
}

View File

@@ -229,7 +229,7 @@ type websocketOrderBook struct {
Asks [][2]string `json:"asks"`
Bids [][2]string `json:"bids"`
Timestamp int64 `json:"timestamp,string"`
Microtimestamp string `json:"microtimestamp"`
Microtimestamp int64 `json:"microtimestamp,string"`
}
// OHLCResponse holds returned candle data

View File

@@ -254,7 +254,7 @@ func (b *Bitstamp) wsUpdateOrderbook(update *websocketOrderBook, p currency.Pair
Bids: make(orderbook.Items, len(update.Bids)),
Asks: make(orderbook.Items, len(update.Asks)),
Pair: p,
LastUpdated: time.Unix(update.Timestamp, 0),
LastUpdated: time.UnixMicro(update.Microtimestamp),
Asset: assetType,
Exchange: b.Name,
VerifyOrderbook: b.CanVerifyOrderbook,
@@ -309,6 +309,7 @@ func (b *Bitstamp) seedOrderBook(ctx context.Context) error {
VerifyOrderbook: b.CanVerifyOrderbook,
Bids: make(orderbook.Items, len(orderbookSeed.Bids)),
Asks: make(orderbook.Items, len(orderbookSeed.Asks)),
LastUpdated: time.Unix(orderbookSeed.Timestamp, 0),
}
for i := range orderbookSeed.Asks {