Margin Risks
Margin trading amplifies both gains and losses. Before using DeepBook Margin, it's critical to understand the risks involved. This guide explains the key risks and provides concrete examples to help you make informed decisions.
Liquidation risk
The most significant risk in margin trading is liquidation - the forced closure of your position when it becomes too risky for the protocol to maintain.
How liquidation works
When you borrow funds to trade, you must maintain a minimum risk ratio (the ratio of your total assets to total debts). If your position's risk ratio falls to or below the Liquidation Risk Ratio, anyone can liquidate your position.
For SUI/USDC (5x leverage), when your risk ratio falls between 1.1 and 1.2, you are in the warning zone. For WAL/USDC and DEEP/USDC (3x leverage), the warning zone is between 1.2 and 1.3. At these levels, even minor price movements can push you into liquidation. Monitor your position carefully and consider adding collateral or reducing your position size.
Partial liquidation
Liquidation in DeepBook Margin is partial, not total. The protocol only liquidates enough of your position to restore your risk ratio to the Target Liquidation Risk Ratio (1.25 for SUI/USDC, 1.5 for WAL/USDC and DEEP/USDC).
During liquidation:
- A liquidator repays a portion of your debt (not all of it)
- They receive collateral plus a liquidation reward (typically 2%)
- The margin pool also takes a fee (typically 3%)
- Your position is restored to the target risk ratio
- You keep the remaining position, but with less equity
This means if you're liquidated, you won't lose your entire position. The liquidator repays just enough debt to bring your ratio back to the target, leaving you with a smaller but healthier position.
However, if your position is severely underwater (assets barely cover debt plus rewards), a full liquidation may occur where all debt is repaid and the lending pool may incur bad debt.
Example: Getting liquidated on SUI/USDC
Let's walk through a concrete example using the SUI/USDC trading pair, which has a Liquidation Risk Ratio of 1.1.
Opening position:
- You deposit 100 USDC as collateral
- You borrow 400 USDC and open a 5x long position on SUI at 1.50 USDC per SUI
- Total assets: 500 USDC
- Total debt: 400 USDC
- Starting risk ratio: 500 / 400 = 1.25
The path to liquidation:
| SUI Price (USDC) | SUI Value (USDC) | Total Assets (USDC) | Risk Ratio | Status |
|---|---|---|---|---|
| 1.50 | 400 | 500 | 1.25 | Safe (at min borrow ratio) |
| 1.425 | 380 | 480 | 1.20 | Warning zone |
| 1.35 | 360 | 460 | 1.15 | Danger zone |
| 1.275 | 340 | 440 | 1.10 | Liquidatable |
| 1.20 | 320 | 420 | 1.05 | Underwater |
What happens at 1.275 USDC per SUI:
- Your risk ratio hits 1.1 (the liquidation threshold for SUI/USDC)
- Your position can now be liquidated by anyone
- A liquidator partially liquidates your position, repaying enough debt to restore your risk ratio to 1.25
- You pay liquidation rewards (5% total: 2% to liquidator, 3% to pool)
- Your remaining position has a 1.25 risk ratio, but with significantly less equity and smaller size
Key insight: With 5x leverage, a mere 15% adverse price movement can trigger liquidation. Without leverage, you'd simply be down 15% on paper.
Liquidation is immediate
Unlike traditional margin calls that give you time to add collateral, DeFi liquidations happen instantly:
- There's no grace period to deposit more funds
- Once your ratio hits the threshold, any liquidator can execute immediately
- You cannot cancel or prevent it once it's triggered
- While partial liquidation preserves some of your position, the equity loss from fees is permanent
Leverage multiplies losses (and gains)
Cryptocurrency prices are highly volatile. Leverage amplifies this volatility on your equity, whether you're long or short.
| Leverage | 10% Adverse Move | 20% Adverse Move | 30% Adverse Move |
|---|---|---|---|
| 1x (no leverage) | -10% equity | -20% equity | -30% equity |
| 2x | -20% equity | -40% equity | -60% equity |
| 3x | -30% equity | -60% equity | -90% equity |
| 5x | -50% equity | Liquidated | Liquidated |
An "adverse move" means:
- Long positions: Price moves down (you borrowed USDC to buy SUI, and SUI drops)
- Short positions: Price moves up (you borrowed SUI to sell for USDC, and SUI rises)
With 5x leverage:
- A 10% adverse price movement = 50% loss on your equity
- A 15-20% adverse price movement = liquidation territory
Crypto markets can move 10-20% in hours. Flash crashes, short squeezes, exchange outages, or major news events can trigger rapid price movements that liquidate leveraged positions before you can react.
Interest rate risk
When you borrow funds, you pay interest that accrues continuously. This interest is variable and can change significantly based on pool utilization.
How interest rates fluctuate
DeepBook Margin uses a kinked interest rate model where rates increase gradually up to an optimal utilization point, then spike dramatically.
Current USDC pool parameters:
| Utilization | Interest Rate (APR) |
|---|---|
| 0% | 0% |
| 50% | 7.5% |
| 80% (optimal) | 12% |
| 85% | 37% |
| 90% (max) | 62% |
Example: Interest rate spike
Imagine you open a leveraged position expecting to pay ~12% APR (at 80% utilization):
- Day 1: Pool utilization is 75%, you're paying ~11% APR
- Day 3: A large borrower enters, pushing utilization to 85%
- Your rate jumps to 37% APR - more than 3x what you expected
- Day 7: Utilization hits 89%, your rate is now ~57% APR
On a 400 USDC borrow:
- At 12% APR: ~0.13 USDC/day in interest
- At 57% APR: ~0.62 USDC/day in interest
Over a month, this difference compounds significantly and can erode your position's equity even if prices don't move against you.
Interest compounds your liquidation risk
Interest accrues to your debt, which means:
- Your total debt increases over time
- Your risk ratio decreases even if asset prices stay flat
- Long-term leveraged positions can drift toward liquidation purely from interest
Example: Starting with a 1.25 risk ratio and 37% APR interest:
- After 30 days, approximately 3% is added to your debt
- Risk ratio drops from 1.25 to ~1.21
- You're now closer to liquidation without any price movement
Oracle risk
DeepBook Margin uses Pyth price oracles to value your assets and debts. While the protocol includes several protections, some oracle-related risks remain:
- Price delays: Oracle prices may lag behind real market prices during extremely volatile periods. The protocol mitigates this by rejecting prices older than around 60 seconds, but brief delays within this window can still occur.
- Price manipulation: Although Pyth is designed to be manipulation-resistant and DeepBook validates prices against confidence intervals and EWMA (exponentially weighted moving average) prices, extreme market conditions could still affect price accuracy.
Oracle protections
DeepBook Margin implements multiple safeguards against oracle issues:
- Staleness protection: Prices older than around 60 seconds are automatically rejected, preventing liquidations based on stale data
- Confidence interval checks: The protocol validates that Pyth price confidence intervals are within acceptable bounds
- EWMA price verification: Spot prices are validated against EWMA prices to detect and reject anomalous price spikes
Risk mitigation strategies
1. Use less than maximum leverage
Just because you can borrow at 5x doesn't mean you should. Consider:
- Using 2-3x leverage instead of 5x
- This gives you more room for price fluctuations before liquidation
2. Monitor your risk ratio actively
- Check your position regularly, especially during volatile markets
- Set up alerts if possible
- Know your liquidation price
3. Use Take Profit / Stop Loss orders
DeepBook Margin supports TPSL orders that automatically close your position:
- Set a stop loss above your liquidation price
- This exits your position with a smaller loss rather than getting liquidated
4. Maintain collateral reserves
- Keep additional funds ready to deposit if your position approaches liquidation
- Remember that adding collateral improves your risk ratio
5. Understand the interest rate environment
- Check current pool utilization before borrowing
- Be prepared for rates to increase
- Factor interest costs into your position sizing
6. Start small
If you're new to margin trading:
- Start with small position sizes
- Learn how the system works with money you can afford to lose
- Gradually increase size as you gain experience
Summary of key risks
| Risk | What Can Happen | How to Mitigate |
|---|---|---|
| Liquidation | Price volatility causes position to be forcibly closed, lose collateral + fees | Use less leverage, set stop losses, monitor positions |
| Interest rates | Borrowing costs spike unexpectedly | Check utilization, factor in rate variability |
| Oracle risk | Prices may not reflect true market | Understand oracle mechanics, avoid extreme leverage |
Related links
Detailed explanation of risk ratios and liquidation thresholds.
How borrow interest rates are calculated.
Set up automated orders to manage risk.
View current risk parameters for all trading pairs.