fix order status convert

This commit is contained in:
c9s 2021-12-27 00:21:52 +08:00
parent dcdf33e2c9
commit c49b9ef276

View File

@ -73,13 +73,14 @@ func toGlobalRewards(maxRewards []max.Reward) ([]types.Reward, error) {
func toGlobalOrderStatus(orderState max.OrderState, executedVolume, remainingVolume fixedpoint.Value) types.OrderStatus { func toGlobalOrderStatus(orderState max.OrderState, executedVolume, remainingVolume fixedpoint.Value) types.OrderStatus {
switch orderState { switch orderState {
case max.OrderStateFinalizing, max.OrderStateDone, max.OrderStateCancel: case max.OrderStateCancel:
if executedVolume > 0 && remainingVolume > 0 { return types.OrderStatusCanceled
return types.OrderStatusPartiallyFilled
case max.OrderStateFinalizing, max.OrderStateDone:
if executedVolume == 0 {
return types.OrderStatusCanceled
} else if remainingVolume == 0 { } else if remainingVolume == 0 {
return types.OrderStatusFilled return types.OrderStatusFilled
} else if executedVolume == 0 {
return types.OrderStatusCanceled
} }
return types.OrderStatusFilled return types.OrderStatusFilled