mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
bbgo: simplify order symbol filtering condition
This commit is contained in:
parent
cf1be9fc6f
commit
10eba876c4
|
@ -285,27 +285,23 @@ func (b *ActiveOrderBook) Print() {
|
|||
func (b *ActiveOrderBook) Update(orders ...types.Order) {
|
||||
hasSymbol := len(b.Symbol) > 0
|
||||
for _, order := range orders {
|
||||
if hasSymbol {
|
||||
if b.Symbol == order.Symbol {
|
||||
b.orders.Update(order)
|
||||
if hasSymbol && b.Symbol != order.Symbol {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
|
||||
b.orders.Update(order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *ActiveOrderBook) Add(orders ...types.Order) {
|
||||
hasSymbol := len(b.Symbol) > 0
|
||||
for _, order := range orders {
|
||||
if hasSymbol {
|
||||
if b.Symbol == order.Symbol {
|
||||
b.add(order)
|
||||
if hasSymbol && b.Symbol != order.Symbol {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
|
||||
b.add(order)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the order to the active order book and check the pending order
|
||||
|
|
Loading…
Reference in New Issue
Block a user