diff --git a/pkg/exchange/binance/exchange.go b/pkg/exchange/binance/exchange.go index ec8f024c2..60f226716 100644 --- a/pkg/exchange/binance/exchange.go +++ b/pkg/exchange/binance/exchange.go @@ -1357,6 +1357,7 @@ func (e *Exchange) QueryDepth(ctx context.Context, symbol string) (snapshot type func convertDepth(symbol string, response *binanceapi.Depth) (snapshot types.SliceOrderBook, finalUpdateID int64, err error) { snapshot.Symbol = symbol snapshot.Time = time.Now() + snapshot.LastUpdateId = response.LastUpdateId finalUpdateID = response.LastUpdateId for _, entry := range response.Bids { diff --git a/pkg/types/sliceorderbook.go b/pkg/types/sliceorderbook.go index da45dd511..08970917d 100644 --- a/pkg/types/sliceorderbook.go +++ b/pkg/types/sliceorderbook.go @@ -21,6 +21,11 @@ type SliceOrderBook struct { // Time represents the server time. If empty, it indicates that the server does not provide this information. Time time.Time + // LastUpdateId is the message id from the server + // this field is optional, not every exchange provides this information + // this is for binance right now. + LastUpdateId int64 + lastUpdateTime time.Time loadCallbacks []func(book *SliceOrderBook)