Skip to content

Commit

Permalink
Merge branch 'main' into jv/default-target-leverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredvu committed Nov 15, 2024
2 parents 95f8853 + a642a3f commit 7e0c33c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ internal class TradeInputProcessor(
TradeInputField.marginMode
-> {
inputType.updateValueAction?.invoke(trade, inputData, parser)

// when moving from cross to isolated, update targetLeverage so it isn't sitting at null
if (trade.marginMode === MarginMode.Isolated) {
val market = marketSummaryState.markets[trade.marketId]
val maxMarketLeverage = market?.perpetualMarket?.configs?.maxMarketLeverage
?: Numeric.double.ONE
trade.targetLeverage = maxMarketLeverage
}

val changedSubaccountNumbers =
MarginCalculator.getChangedSubaccountNumbers(
parser = parser,
Expand Down

0 comments on commit 7e0c33c

Please sign in to comment.