Skip to content

Commit

Permalink
fix: Ignore orders that reduce position in equity check (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredvu authored Nov 25, 2024
1 parent 72222b8 commit 9e45b54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.13.34"
version = "1.13.35"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ internal class TradeOrderInputValidator(
val currentFreeCollateral = subaccount.calculated.get(CalculationPeriod.current)?.freeCollateral ?: return null
val postFreeCollateral = subaccount.calculated.get(CalculationPeriod.post)?.freeCollateral ?: return null
val orderEquity = currentFreeCollateral - postFreeCollateral
val isReducingPosition = orderEquity < Numeric.double.ZERO

if (postFreeCollateral >= Numeric.double.ZERO && orderEquity < isolatedLimitOrderMinimumEquity) {
if (postFreeCollateral >= Numeric.double.ZERO && !isReducingPosition && orderEquity < isolatedLimitOrderMinimumEquity) {
return createTradeBoxWarningOrError(
errorLevel = ErrorType.error,
errorCode = "ISOLATED_MARGIN_LIMIT_ORDER_BELOW_MINIMUM",
Expand Down
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.13.34'
spec.version = '1.13.35'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit 9e45b54

Please sign in to comment.