bbgo: rename func isNewerOrderUpdate

This commit is contained in:
c9s 2023-11-22 17:44:41 +08:00
parent 9e663916ed
commit 6b27722b03
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 6 additions and 6 deletions

View File

@ -335,7 +335,7 @@ func (b *ActiveOrderBook) Add(orders ...types.Order) {
}
}
func isNewerUpdate(a, b types.Order) bool {
func isNewerOrderUpdate(a, b types.Order) bool {
// compare state first
switch a.Status {
@ -364,10 +364,10 @@ func isNewerUpdate(a, b types.Order) bool {
}
}
return isNewerUpdateTime(a, b)
return isNewerOrderUpdateTime(a, b)
}
func isNewerUpdateTime(a, b types.Order) bool {
func isNewerOrderUpdateTime(a, b types.Order) bool {
au := time.Time(a.UpdateTime)
bu := time.Time(b.UpdateTime)
@ -388,7 +388,7 @@ func (b *ActiveOrderBook) add(order types.Order) {
// if the pending order update time is newer than the adding order
// we should use the pending order rather than the adding order.
// if pending order is older, than we should add the new one, and drop the pending order
if isNewerUpdate(pendingOrder, order) {
if isNewerOrderUpdate(pendingOrder, order) {
order = pendingOrder
}

View File

@ -74,7 +74,7 @@ func Test_isNewerUpdate(t *testing.T) {
Status: types.OrderStatusPartiallyFilled,
ExecutedQuantity: number(0.1),
}
ret := isNewerUpdate(a, b)
ret := isNewerOrderUpdate(a, b)
assert.True(t, ret)
}
@ -85,6 +85,6 @@ func Test_isNewerUpdateTime(t *testing.T) {
b := types.Order{
UpdateTime: types.NewTimeFromUnix(100, 0),
}
ret := isNewerUpdateTime(a, b)
ret := isNewerOrderUpdateTime(a, b)
assert.True(t, ret)
}