Skip to content

Commit

Permalink
fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-onthelawn committed May 14, 2024
1 parent a8bcd7e commit 3784b8a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import exchange.dydx.abacus.utils.Numeric
import exchange.dydx.abacus.utils.mutable
import exchange.dydx.abacus.utils.safeSet
import kotlin.math.abs
import kotlin.math.max

internal object TriggerOrdersConstants {
const val TRIGGER_ORDER_DEFAULT_DURATION_DAYS = 90.0
Expand Down Expand Up @@ -89,10 +90,10 @@ internal class TriggerOrdersInputCalculator(val parser: ParserProtocol) {
val positionSide = parser.asString(parser.value(position, "resources.indicator.current"))
val positionSize = parser.asDouble(parser.value(position, "size.current"))?.abs() ?: return modified
val notionalTotal = parser.asDouble(parser.value(position, "notionalTotal.current")) ?: return modified
val leverage = Math.max(parser.asDouble(parser.value(position, "leverage.current"))!!.abs(), 1.0)
val leverage = max(parser.asDouble(parser.value(position, "leverage.current"))!!.abs(), 1.0)

if (size == null || size == Numeric.double.ZERO || notionalTotal == Numeric.double.ZERO || leverage == Numeric.double.ZERO) {
// A valid position size should never have 0 size, notional value or leverage.
if (size == null || size == Numeric.double.ZERO || notionalTotal == Numeric.double.ZERO) {
// A valid position size should never have 0 size, notional value.
return modified;
}

Expand Down

0 comments on commit 3784b8a

Please sign in to comment.