binance: set snapshot.Time to now()

This commit is contained in:
c9s 2024-02-06 12:25:40 +08:00
parent 7e5d25a7e0
commit b3ef66dff4
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 2 additions and 3 deletions

View File

@ -1356,8 +1356,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
// empty time since the API does not provide time information.
snapshot.Time = time.Time{}
snapshot.Time = time.Now()
finalUpdateID = response.LastUpdateId
for _, entry := range response.Bids {

View File

@ -136,7 +136,7 @@ func (b *SliceOrderBook) updateBids(pvs PriceVolumeSlice) {
func (b *SliceOrderBook) update(book SliceOrderBook) {
b.updateBids(book.Bids)
b.updateAsks(book.Asks)
b.lastUpdateTime = time.Now()
b.lastUpdateTime = defaultTime(book.Time, time.Now)
}
func (b *SliceOrderBook) Reset() {