diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/wallet/account/OrderProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/wallet/account/OrderProcessor.kt index a1345538f..8807e8eb6 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/wallet/account/OrderProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/wallet/account/OrderProcessor.kt @@ -229,8 +229,9 @@ internal class OrderProcessor(parser: ParserProtocol) : BaseProcessor(parser) { // if order is short-term order and indexer returns best effort canceled and has no partial fill // treat as a pending order until it's partially filled or finalized val isBestEffortCanceled = modified["status"] == "BEST_EFFORT_CANCELED" - val isNotUserCanceled = modified["cancelReason"] != "USER_CANCELED" - if (orderFlags.equals(Numeric.double.ZERO) && isBestEffortCanceled && isNotUserCanceled) { + val cancelReason = parser.asString(modified["cancelReason"]) + val isUserCanceled = cancelReason == "USER_CANCELED" || cancelReason == "ORDER_REMOVAL_REASON_USER_CANCELED" + if (orderFlags.equals(Numeric.double.ZERO) && isBestEffortCanceled && !isUserCanceled) { modified.safeSet("status", "PENDING") } } diff --git a/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4SubaccountTests.kt b/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4SubaccountTests.kt index eaf03ad1b..e866bac1d 100644 --- a/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4SubaccountTests.kt +++ b/src/commonTest/kotlin/exchange.dydx.abacus/payload/v4/V4SubaccountTests.kt @@ -1980,7 +1980,7 @@ class V4SubaccountTests : V4BaseTests() { "size":"545", "price":"2.201", "type":"LIMIT", - "status":"BEST_EFFORT_CANCELED", + "status":"PENDING", "timeInForce":"IOC", "postOnly":false, "reduceOnly":false, @@ -1998,7 +1998,7 @@ class V4SubaccountTests : V4BaseTests() { "size":"3540", "price":"0.5649", "type":"LIMIT", - "status":"BEST_EFFORT_CANCELED", + "status":"PENDING", "timeInForce":"IOC", "postOnly":false, "reduceOnly":false,