Skip to content

Commit

Permalink
fix params
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-onthelawn committed Apr 22, 2024
1 parent 58bc0e3 commit 1d08a8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
import kotlin.time.times
import kotlin.time.toDuration
import exchange.dydx.abacus.utils.Logger

@JsExport
open class StateManagerAdaptor(
Expand Down Expand Up @@ -1804,20 +1803,13 @@ open class StateManagerAdaptor(
val postOnly = false

val timeInForce = null;
// when (triggerOrder.type) {
// OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC"
// OrderType.stopLimit, OrderType.takeProfitLimit -> "GTT"
// else -> throw Exception("invalid triggerOrderType")
// }

val execution = when (triggerOrder.type) {
OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC"
OrderType.stopLimit, OrderType.takeProfitLimit -> "Default"
OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT"
else -> throw Exception("invalid triggerOrderType")
}

Logger.e { "xcxc error: ${type} ${execution}"}

val duration = GoodTil.duration(TradeInputGoodUntil(TRIGGER_ORDER_DEFAULT_DURATION_DAYS, "D")) ?: throw Exception("invalid duration")
val goodTilTimeInSeconds = (duration / 1.seconds).toInt()
val goodTilBlock = null
Expand Down Expand Up @@ -1955,14 +1947,11 @@ open class StateManagerAdaptor(
}

val execution = if (trade.options?.executionOptions != null) {
trade.execution ?: "Default"
trade.execution ?: "DEFAULT"
} else {
null
}

Logger.e { "xcxc ${timeInForce} ${execution}"}


val goodTilTimeInSeconds = (
(
if (trade.options?.goodTilUnitOptions != null) {
Expand Down Expand Up @@ -2031,7 +2020,7 @@ open class StateManagerAdaptor(
val price = summary.payloadPrice ?: throw Exception("price is null")
val size = summary.size ?: throw Exception("size is null")
val timeInForce = "IOC"
val execution = "Default"
val execution = "DEFAULT"
val reduceOnly = environment.featureFlags.reduceOnlySupported
val postOnly = false
val goodTilTimeInSeconds = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import kotlinx.serialization.json.Json
import kotlin.random.Random
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.seconds
import exchange.dydx.abacus.utils.Logger

internal class SubaccountSupervisor(
stateMachine: TradingStateMachine,
Expand Down Expand Up @@ -842,16 +841,12 @@ internal class SubaccountSupervisor(
null
}



val execution = if (trade.options?.executionOptions != null) {
trade.execution ?: "Default"
trade.execution ?: "DEFAULT"
} else {
null
}

Logger.e { "xcxc ${timeInForce} ${execution}"}

val goodTilTimeInSeconds = (
(
if (trade.options?.goodTilUnitOptions != null) {
Expand Down Expand Up @@ -910,20 +905,12 @@ internal class SubaccountSupervisor(

val timeInForce = null;

// when (triggerOrder.type) {
// OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC"
// OrderType.stopLimit, OrderType.takeProfitLimit -> "GTT"
// else -> throw Exception("invalid triggerOrderType")
// }

val execution = when (triggerOrder.type) {
OrderType.stopMarket, OrderType.takeProfitMarket -> "IOC"
OrderType.stopLimit, OrderType.takeProfitLimit -> "Default"
OrderType.stopLimit, OrderType.takeProfitLimit -> "DEFAULT"
else -> throw Exception("invalid triggerOrderType")
}

Logger.e { "xcxc error: ${type} ${execution}"}

val duration = GoodTil.duration(TradeInputGoodUntil(TRIGGER_ORDER_DEFAULT_DURATION_DAYS, "D")) ?: throw Exception("invalid duration")
val goodTilTimeInSeconds = (duration / 1.seconds).toInt()
val goodTilBlock = null
Expand Down Expand Up @@ -1004,7 +991,7 @@ internal class SubaccountSupervisor(
}

if (triggerOrders.stopLossOrder != null) {
updateTriggerOrder(triggerOrders.stopLossOrder)
updateTriggerOrder(triggerOrders.stopLossOrder)
}

if (triggerOrders.takeProfitOrder != null) {
Expand All @@ -1024,7 +1011,7 @@ internal class SubaccountSupervisor(
val price = summary.payloadPrice ?: throw Exception("price is null")
val size = summary.size ?: throw Exception("size is null")
val timeInForce = "IOC"
val execution = "Default"
val execution = "DEFAULT"
val reduceOnly = helper.environment.featureFlags.reduceOnlySupported
val postOnly = false
val goodTilTimeInSeconds = null
Expand Down

0 comments on commit 1d08a8d

Please sign in to comment.