mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
bbgo/activeOrderBook: filter market order when filtering existing orders
This commit is contained in:
parent
86e464b1bc
commit
88d7783843
|
@ -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) {
|
func (b *ActiveOrderBook) filterExistingOrders(orders []types.Order) (existingOrders types.OrderSlice) {
|
||||||
for _, o := range orders {
|
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) {
|
if b.Exists(o) {
|
||||||
existingOrders.Add(o)
|
existingOrders.Add(o)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user