bbgo/activeOrderBook: filter market order when filtering existing orders

This commit is contained in:
c9s 2024-08-29 00:38:44 +08:00
parent 86e464b1bc
commit 88d7783843
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -466,6 +466,12 @@ func (b *ActiveOrderBook) Lookup(f func(o types.Order) bool) *types.Order {
func (b *ActiveOrderBook) filterExistingOrders(orders []types.Order) (existingOrders types.OrderSlice) {
for _, o := range orders {
// skip market order
// this prevents if someone added a market order to the active order book
if o.Type == types.OrderTypeMarket {
continue
}
if b.Exists(o) {
existingOrders.Add(o)
}