diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index f821a4fb3..1e36b83fc 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -189,13 +189,19 @@ func (s *Strategy) updateQuote(ctx context.Context, orderExecutionRouter bbgo.Or // use mid-price for the last price s.lastPrice = (bestBid.Price + bestAsk.Price).Float64() / 2 + bookLastUpdateTime := s.book.LastUpdateTime() + if _, err := s.bidPriceHeartBeat.Update(bestBid, priceUpdateTimeout) ; err != nil { - log.WithError(err).Errorf("quote update error, %s price not updating", s.Symbol) + log.WithError(err).Errorf("quote update error, %s price not updating, order book last update: %s ago", + s.Symbol, + time.Since(bookLastUpdateTime)) return } if _, err := s.askPriceHeartBeat.Update(bestAsk, priceUpdateTimeout) ; err != nil { - log.WithError(err).Errorf("quote update error, %s price not updating", s.Symbol) + log.WithError(err).Errorf("quote update error, %s price not updating, order book last update: %s ago", + s.Symbol, + time.Since(bookLastUpdateTime)) return } diff --git a/pkg/types/orderbook.go b/pkg/types/orderbook.go index 4accea353..8bae186c8 100644 --- a/pkg/types/orderbook.go +++ b/pkg/types/orderbook.go @@ -51,6 +51,13 @@ func (b *MutexOrderBook) IsValid() (ok bool, err error) { return ok, err } +func (b *MutexOrderBook) LastUpdateTime() time.Time { + b.Lock() + t := b.OrderBook.LastUpdateTime() + b.Unlock() + return t +} + func (b *MutexOrderBook) BestBidAndAsk() (bid, ask PriceVolume, ok bool) { var ok1, ok2 bool b.Lock()