Skip to content

Commit

Permalink
Merge pull request #1751 from lanphan/fixemitnew
Browse files Browse the repository at this point in the history
fix OnNew event must be called before OnFilled
  • Loading branch information
c9s authored Sep 26, 2024
2 parents f2ecf8a + 2a767ab commit 6e19777
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/bbgo/activeorderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ func (b *ActiveOrderBook) Add(orders ...types.Order) {
}

b.add(order)
b.EmitNew(order)
}
}

Expand Down Expand Up @@ -424,6 +423,7 @@ func (b *ActiveOrderBook) add(order types.Order) {

b.orders.Add(order)
b.pendingOrderUpdates.Remove(pendingOrder.OrderID)
b.EmitNew(order)

// when using add(order), it's usually a new maker order on the order book.
// so, when it's not status=new, we should trigger order update handler
Expand All @@ -434,6 +434,7 @@ func (b *ActiveOrderBook) add(order types.Order) {

} else {
b.orders.Add(order)
b.EmitNew(order)
}
}

Expand Down

0 comments on commit 6e19777

Please sign in to comment.