bbgo: replace update time check with isNewerOrderUpdate func call

This commit is contained in:
c9s 2023-11-22 17:56:13 +08:00
parent 6b27722b03
commit 326a0c6128
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -276,8 +276,7 @@ func (b *ActiveOrderBook) Update(order types.Order) {
// if order update time is too old, skip it // if order update time is too old, skip it
if previousOrder, ok := b.orders.Get(order.OrderID); ok { if previousOrder, ok := b.orders.Get(order.OrderID); ok {
previousUpdateTime := previousOrder.UpdateTime.Time() if isNewerOrderUpdate(previousOrder, order) {
if !previousUpdateTime.IsZero() && order.UpdateTime.Before(previousUpdateTime) {
log.Infof("[ActiveOrderBook] order #%d updateTime %s is out of date, skip it", order.OrderID, order.UpdateTime) log.Infof("[ActiveOrderBook] order #%d updateTime %s is out of date, skip it", order.OrderID, order.UpdateTime)
b.mu.Unlock() b.mu.Unlock()
return return