mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
types: fix order book copy
This commit is contained in:
parent
98247385f9
commit
dc6d60216b
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user