🔍Paradex Risk Checks

Order Risk Check

Order Risk Check Conditions

An order is accepted if :

  • The account meets the Initial Margin Requirement after including the new order, i.e. Account ValueAccount Initial Margin Requirement\text{Account Value}\ge\text{Account Initial Margin Requirement}

  • Including the order does not result in an increase of the Initial Margin Requirement

Example

Setup :

  • Alice has 100 USD worth of collateral and uses Cross Margin mode

  • Mark Price XYZ-USD-PERP=100\text{Mark Price}_\text{ XYZ-USD-PERP}=100

Alice successfully submits a buy XYZ-USD-PERP order of size 10

Assuming Initial Margin Fraction (IMF) of 10% (i.e. a maximum leverage of 10x), the Initial Margin Requirement is : 10%10100=100 USD10\%*10*100=100~\text{USD}

Alice has no open position and therefore has an Account Value of 100 USD. The order is then accepted since the account meets the IMR condition.

Price drop :

The Mark Price of XYZ-USD-PERP drops to 98.

Account IMR=10%1098=98 USD\text{Account IMR}=10\%*10*98=98~\text{USD}

Unrealized PnL=10(98100)=20 USD\text{Unrealized PnL}=10*(98-100)=-20~ \text{USD}

Account Value=10020=80 USD<Account IMR\text{Account Value}=100-20=80~\text{USD}<\text{Account IMR}

Although Alice's account value is below IMR, deleveraging check does not monitor the account since it has no open orders

Submission of an offsetting order :

Alice submits a sell order of size 5. Since this is an offsetting order which is smaller than the position size, it does not increase the Open Size therefore does not increase the Account IMR. The order is accepted.

Submission of another order that brings the total sell orders size above the position size

Later, Alice submits a new sell order of size 8. This is also an offsetting order but it does result in an increase in Alice's XYZ-USD-PERP Open Size from 10 to 13. Therefore, this order increases the account IMR. Since the account also does not meet IMR, this order is rejected.

Health Check

Health Check is a periodic check on account's Margin Ratio. This check is done once every 5 seconds. An account passes the health check if its account value is positive and the margin ratio is below 100%.

If : The account is marked in Unhealthy Mode. Accounts in Unhealthy Mode are available for Liquidation.

The account cannot submit any new order and will be available to be taken over by liquidators.

Withdrawal Check

The amount of USDC that can be withdrawn is subject to an upper limit that depends on the Free Collateral Balance expressed in USDC terms. However, the user cannot withdraw more than the Account USDC Balance :

Withdrawable USDC Amount=min(Account USDC Balance, max(0,Free Collateral BalanceUSDC Oracle Price))\small\text{Withdrawable USDC Amount}=\min\Bigg(\text{Account USDC Balance} ,~\max\Big(0, \frac{\text{Free Collateral Balance}}{\text{USDC Oracle Price}}\Big)\Bigg)

Last updated