types: fix order book copy

This commit is contained in:
c9s 2022-01-13 11:09:32 +08:00
parent 98247385f9
commit dc6d60216b
2 changed files with 2 additions and 2 deletions

View File

@ -196,7 +196,7 @@ func (s *Strategy) updateQuote(ctx context.Context, orderExecutionRouter bbgo.Or
return return
} }
sourceBook := s.book.CopyDepth(20) sourceBook := s.book.CopyDepth(10)
if valid, err := sourceBook.IsValid(); !valid { if valid, err := sourceBook.IsValid(); !valid {
log.WithError(err).Errorf("%s invalid copied order book, skip quoting: %v", s.Symbol, err) log.WithError(err).Errorf("%s invalid copied order book, skip quoting: %v", s.Symbol, err)
return return

View File

@ -143,7 +143,7 @@ func (b *RBTOrderBook) Copy() OrderBook {
func (b *RBTOrderBook) CopyDepth(limit int) OrderBook { func (b *RBTOrderBook) CopyDepth(limit int) OrderBook {
var book = NewRBOrderBook(b.Symbol) var book = NewRBOrderBook(b.Symbol)
book.Asks = b.Asks.CopyInorder(limit) book.Asks = b.Asks.CopyInorder(limit)
book.Bids = b.Bids.CopyInorder(limit) book.Bids = b.Bids.CopyInorderReverse(limit)
return book return book
} }