Skip to main content

Risk Ratio

Risk ratios are the core mechanism that governs leverage limits and position safety in DeepBook Margin. Understanding these ratios is essential for managing margin positions effectively.

What is a risk ratio?​

DeepBook Margin defines the risk ratio as:

risk_ratio = total_assets / total_debts

Where DeepBook Margin values assets and debts in a common denomination using oracle prices. A higher risk ratio indicates a safer position with more collateral relative to debt.

The following examples also show the equivalent LTV (loan-to-value): your debt as a percentage of your assets, which is the inverse of the risk ratio.

  • Risk ratio = 2.0: You have 2 units of assets for every 1 unit of debt (50% LTV)
  • Risk ratio = 1.25: You have 1.25 units of assets for every 1 unit of debt (80% LTV)
  • Risk ratio = 1.0: Your assets exactly equal your debts (100% LTV, insolvent)

Risk ratio thresholds​

Each trading pair has four risk ratio thresholds that control different operations. Typical values in this section are common settings, not fixed system values. Each trading pair has its own actual thresholds.

Min withdraw risk ratio​

The minimum risk ratio required after withdrawing collateral.

  • If a withdrawal would cause your position's risk ratio to fall below this threshold, DeepBook Margin rejects the withdrawal
  • This prevents you from extracting too much collateral and leaving an unsafe position
  • Typically 2.0 (50% LTV), meaning you must maintain at least 2 units of assets per 1 unit of debt to withdraw

Min borrow risk ratio​

The minimum risk ratio required after borrowing additional funds.

  • If a borrow would cause your position's risk ratio to fall below this threshold, DeepBook Margin rejects the borrow
  • This determines the maximum leverage available for the trading pair
  • A min borrow ratio of 1.25 allows approximately 5x leverage
  • A min borrow ratio of 1.5 allows approximately 3x leverage

Liquidation risk ratio​

The risk ratio threshold at which a position becomes eligible for liquidation.

  • When a position's risk ratio falls to or below this value, anyone can liquidate the position
  • This is the danger zone: if price moves against you and your ratio hits this level, anyone can liquidate your position
  • Typically between 1.1 and 1.2 depending on asset volatility

Target liquidation risk ratio​

The target risk ratio that liquidation aims to restore the position to.

  • Liquidation repays enough debt to bring the position back to a healthy state at this ratio
  • This ensures the position is safe after liquidation, not just barely above the liquidation threshold
  • Typically equals the Min Borrow Risk Ratio

Summary of threshold checks​

The four thresholds translate into the following rules:

withdraw allowed      IF (new_total_assets / new_total_debts) >= min_withdraw_risk_ratio
borrow allowed IF (new_total_assets / new_total_debts) >= min_borrow_risk_ratio
liquidation eligible IF risk_ratio <= liquidation_risk_ratio

Here new_total_assets and new_total_debts are the position's values after the withdrawal or borrow.

How leverage is determined​

The Min Borrow Risk Ratio determines the maximum leverage for a trading pair:

Max Leverage≈11−1Min Borrow Risk Ratio\text{Max Leverage} \approx \frac{1}{1 - \frac{1}{\text{Min Borrow Risk Ratio}}}

In code form:

max_leverage = 1 / (1 - 1 / min_borrow_risk_ratio)

In plain terms, leverage is your total assets divided by your own equity (assets minus debt). At the Min Borrow Risk Ratio, debt makes up 1 / min_borrow_risk_ratio of your assets, so the lower the ratio, the smaller your equity share and the higher your leverage.

Min Borrow Risk RatioApproximate Max Leverage
1.255x
1.53x
2.02x

Example: SUI/USDC position lifecycle​

Consider a SUI/USDC position with the following risk parameters:

  • Min Withdraw Risk Ratio: 2.0
  • Min Borrow Risk Ratio: 1.25
  • Liquidation Risk Ratio: 1.1
  • Target Liquidation Risk Ratio: 1.25

Opening a position:

  1. You deposit 100 USDC as collateral
  2. You borrow 400 USDC worth of SUI
  3. Total assets = 100 USDC collateral + 400 USDC worth of SUI = 500 USDC
  4. Total debt = 400 USDC
  5. Risk ratio = 500/400 = 1.25 (at the minimum borrow ratio)
  6. You now have 5x leveraged exposure to SUI

Price moves in your favor:

  1. SUI price increases 10%, your SUI is now worth 440 USDC
  2. Total assets = 100 + 440 = 540 USDC, debt is still 400 USDC
  3. Risk ratio = 540/400 = 1.35 (safer position)
  4. You can withdraw some profit, as long as ratio stays above 2.0

Price moves against you:

  1. SUI price drops 10%, your SUI is now worth 360 USDC
  2. Total assets = 100 + 360 = 460 USDC, debt is still 400 USDC
  3. Risk ratio = 460/400 = 1.15 (approaching liquidation)
  4. If SUI drops further to 340 USDC worth, ratio = (100 + 340)/400 = 1.1 (liquidation threshold)
  5. Anyone can now liquidate your position
  6. Liquidator repays part of your debt and receives collateral plus a reward
  7. After liquidation, your remaining position has a risk ratio of 1.25

Liquidation rewards​

When someone liquidates a position:

  • User Liquidation Reward: A percentage of the liquidated amount paid to the liquidator as incentive (typically 2%)
  • Pool Liquidation Reward: A percentage paid to the margin pool to cover potential bad debt (typically 3%)

These rewards give liquidators an incentive to maintain system health and ensure the protocol has reserves against defaults.

Risk management best practices​

  1. Monitor your risk ratio: Keep track of your position's health, especially during volatile markets
  2. Maintain a buffer: Don't borrow up to the maximum; leave room for price fluctuations
  3. Set stop losses: Use TPSL orders to automatically close positions before liquidation
  4. Understand the assets: Higher volatility assets typically have stricter risk parameters (lower leverage)