mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
xmaker: show order book last update time
This commit is contained in:
parent
2aeb9e870c
commit
5cc3a88911
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user