From 88d7783843b33f8e1ebcb58c1744f9e82d322d8e Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 29 Aug 2024 00:38:44 +0800 Subject: [PATCH] bbgo/activeOrderBook: filter market order when filtering existing orders --- pkg/bbgo/activeorderbook.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/bbgo/activeorderbook.go b/pkg/bbgo/activeorderbook.go index f94094ff2..ced172ab2 100644 --- a/pkg/bbgo/activeorderbook.go +++ b/pkg/bbgo/activeorderbook.go @@ -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) }