diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt index bf562fbf8..6d76657a0 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/StateManagerAdaptor.kt @@ -1802,11 +1802,16 @@ open class StateManagerAdaptor( val reduceOnly = true val postOnly = false - val timeInForce = null; // TP/SL orders always have a null timeInForce. IOC/FOK/PostOnly/GTD is distinguished by the execution field. + // TP/SL orders always have a null timeInForce. IOC/FOK/PostOnly/GTD is distinguished by the execution field. + val timeInForce = null; + /** + * TP/SL market orders default to IOC execution. + * TP/SL limit orders default to GTD (default) execution. + */ val execution = when (triggerOrder.type) { - OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC" // All TP/SL market orders currently default to IOC execution. - OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT" // All TP/SL limit orders currently default to GTD (default) execution. + OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC" + OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT" else -> throw Exception("invalid triggerOrderType") } diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt index daf965cc2..03586b88c 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt @@ -903,11 +903,16 @@ internal class SubaccountSupervisor( val reduceOnly = true val postOnly = false - val timeInForce = null; // TP/SL orders always have a null timeInForce. IOC/FOK/PostOnly/GTD is distinguished by the execution field. + // TP/SL orders always have a null timeInForce. IOC/FOK/PostOnly/GTD is distinguished by the execution field. + val timeInForce = null; + /** + * TP/SL market orders default to IOC execution. + * TP/SL limit orders default to GTD (default) execution. + */ val execution = when (triggerOrder.type) { - OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC" // All TP/SL market orders currently default to IOC execution. - OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT" // All TP/SL limit orders currently default to GTD (default) execution. + OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC" + OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT" else -> throw Exception("invalid triggerOrderType") }