For the complete documentation index, see llms.txt. This page is also available as Markdown.

Margining (Legacy)

Margin calculations closely mirror the formulas utilized by centralized derivatives exchanges.

Margin Mode

When opening a position, a margin mode must be selected. Cross margin (default) utilizes shared collateral across all cross-margin positions for maximum capital efficiency. An isolated margin restricts collateral allocation to the specific asset, ensuring liquidation:

  • In isolated positions, the margin doesn't affect cross/other isolated positions.

  • In cross/other isolated positions, the margin doesn't affect this isolated position

  • Isolated margin only supports USDC as collateral, and PNL can be offset within positions using the same asset.

  • Cross margin supports multiple assets (USDC, BTC, ETH) as collateral, and PNL can be offset across them.

Initial Margin and Leverage

Users may select leverage as any integer between 1 and the asset-specific maximum leverage. Position margin requirements are calculated as: Initial Margin = Position Size × Mark Price ÷ Leverage

  • Cross Margin:

    • Initial margin is locked and non-withdrawable

    • Unrealized PNL automatically serves as available margin for new positions

  • Isolated Margin:

    • Supports post-opening margin adjustments (add/remove)

    • Unrealized PNL applies as an additional margin to the open position

Unrealized PNL and transfer margin

Unrealized PNL withdrawal from isolated positions or cross accounts follows the following formulas:

  • initialMargin = entryPrice * positionSize / leverage

  • floatingMargin = isolatedMargin - initialMargin

  • floatingProfit = calculateFloatingProfitAndLoss(...)

  • availableSubtractMargin = max(0, min(floatingMargin, floatingMargin + floatingProfit))

'Transfer' encompasses any non-trading margin removal, including:

  • External withdrawals

  • Transfers to spot wallets

  • Isolated margin position transfers

Maintenance Margin & Liquidation Mechanics

Cross positions trigger liquidation when: Account Value (incl. unrealized PNL) < Maintenance Margin × Total Open Notional PositionMaintenance Margin = Position value * mainMarginRateThe value of mainMarginRate in various symbols is different. For example, when you open a position below maxNominalValue of 12,500,000 USDC under BTC_USDC, then the mainMarginRate is 0.004. The current Maintenance Margin Rate (mainMarginRate) on SoDEX Testnet for different symbols is consistent, as follows (Updated on 2025.08.01):

Bracket
Max Nominal Value (USDC)
Maint Margin Rate
Start Margin Rate
Max Leverage
Min Leverage

1

10,000,000

0.30%

0.50%

200x

1x

2

12,500,000

0.40%

0.80%

125x

1x

3

20,000,000

0.50%

1.00%

100x

1x

4

25,000,000

1.00%

2.00%

50x

1x

5

50,000,000

2.50%

5.00%

20x

1x

6

100,000,000

5.00%

10.00%

10x

1x

7

200,000,000

10.00%

20.00%

5x

1x

8

400,000,000

12.50%

25.00%

4x

1x

9

1,500,000,000

15.00%

33.30%

3x

1x

10

2,000,000,000

25.00%

50.00%

2x

1x

11

5,000,000,000

50.00%

100.00%

1x

1x

Isolated positions follow identical liquidation logic, with computation inputs solely comprising:

  • Isolated margin balance

  • The isolated position's notional value

Last updated