From 6b27722b03a85d89dea34c6e4888470bf8645f4a Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 22 Nov 2023 17:44:41 +0800 Subject: [PATCH] bbgo: rename func isNewerOrderUpdate --- pkg/bbgo/activeorderbook.go | 8 ++++---- pkg/bbgo/activeorderbook_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/bbgo/activeorderbook.go b/pkg/bbgo/activeorderbook.go index 4855cc89d..547ba46e7 100644 --- a/pkg/bbgo/activeorderbook.go +++ b/pkg/bbgo/activeorderbook.go @@ -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 } diff --git a/pkg/bbgo/activeorderbook_test.go b/pkg/bbgo/activeorderbook_test.go index c09a5d843..eb0a28e35 100644 --- a/pkg/bbgo/activeorderbook_test.go +++ b/pkg/bbgo/activeorderbook_test.go @@ -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) }