mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
bbgo: rename func isNewerOrderUpdate
This commit is contained in:
parent
9e663916ed
commit
6b27722b03
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user