# Margin trading on Abyss

Beyond Spot trading, Abyss also offers Margin trading. Margin allows traders to take on leverage on top of their assets to trade with more than they actually have. This obviously allows traders to potentially make more but they also can lose proportionally more and be at risk of getting liquidated.

### Key Concepts

#### Leverage

Leverage allows you to control a larger position than your deposited collateral would normally allow by borrowing additional funds.

* **1x**: No leverage (trading with only your own capital)
* **3x**: Your position is 3 times your collateral
* **5x**: Your position is 5 times your collateral

**Example**: With $100 collateral and 5x leverage, you can open a $500 position. Profits and losses are amplified by the leverage factor.

#### Margin Manager

A Margin Manager is a smart contract account that:

* Holds your collateral (base assets, quote assets, or DEEP)
* Tracks your borrowed amounts
* Manages your leveraged positions

You can create multiple margin managers to separate different trading strategies.

#### Collateral

Collateral is the assets you deposit to secure your leveraged positions. Acceptable collateral types:

* **Base asset** (e.g., SUI)
* **Quote asset** (e.g., USDC)
* **DEEP tokens**

Your collateral value is calculated in USD equivalent for risk calculations.

#### Risk Ratio

The risk ratio measures the health of your position:

```
Risk Ratio = Collateral Value / Borrowed Amount
```

| Risk Ratio | Status      | Action Allowed                |
| ---------- | ----------- | ----------------------------- |
| ≥ 2.0      | Healthy     | Withdraw freely               |
| 1.25 - 2.0 | Moderate    | Can borrow more               |
| 1.1 - 1.25 | At Risk     | Must repay or add collateral  |
| ≤ 1.1      | Liquidation | Position closed automatically |

#### Liquidation

If your risk ratio falls below the liquidation threshold, your position will be automatically closed:

| Pair      | Liquidation Threshold |
| --------- | --------------------- |
| SUI/USDC  | 1.1x                  |
| WAL/USDC  | 1.2x                  |
| DEEP/USDC | 1.2x                  |

When liquidated:

* Your position is sold to repay the borrowed amount
* A 2-3% liquidation reward is paid to the liquidator
* Remaining collateral (if any) stays in your margin manager

### Getting Started

If it's your first time you will be prompted to create a new margin account for the market you've selected. Let's take SUI/USDC for our example. You can deposit one of three assets at a time into your margin account: the base asset (SUI ) the quote asset (USDC) or DEEP (to pay less trading fees). The margin account also shows you the amount of borrowed assets it currently has and the risk ratio dropdown gives you an idea of how healthy the position is and what functions are available to you based on your current risk ratio.

#### Opening a Position TLDR

1. **Select Trading Pair**: Choose your pair from the trading header (e.g., SUI/USDC)
2. **Create or Select a Margin Manager**:
   * Use the Margin Manager Selector panel
   * Click "Create New" for a fresh margin manager, or
   * Select an existing one from the dropdown
3. **Deposit Collateral**:
   * Click the deposit button in the order placement panel
   * Select your asset type (SUI, USDC, or DEEP)
   * Enter the amount and confirm the transaction
4. **Place Your Order**:
   * Select **Buy** (long) or **Sell** (short)
   * Choose order type:
     * **Market**: Executes immediately at current price
     * **Limit**: Executes when price reaches your specified level
   * Enter quantity
   * Adjust leverage using the slider (1.0x - 5.0x)
   * Review the estimated liquidation price
   * Click "Place Order" and confirm in your wallet

<figure><img src="https://21702300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl3ISq3b5D0pJQwrCHpTo%2Fuploads%2FYYjvZNeadRj5WGIyckUD%2FScreenshot%202026-01-22%20at%201.03.51%E2%80%AFPM.png?alt=media&#x26;token=77fe198e-75f1-4c6a-8f4e-f3ae6a9a803a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
&#x20;If you wish to go short and long at the same time you will need to create two separate margin accounts for one market although there is not much use to doing this. You cannot borrow the base and quote asset at the same time.
{% endhint %}

<figure><img src="https://21702300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl3ISq3b5D0pJQwrCHpTo%2Fuploads%2FDVmz0aoxcwgaqVTRoFBX%2FScreenshot%202026-01-22%20at%201.18.25%E2%80%AFPM.png?alt=media&#x26;token=eb8538cd-1c8c-463d-8a4f-f5089730ba57" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The amount is automatically calculated based on your margin account balance and the leverage you selected. If you set 1x leverage no assets will be borrowed so it becomes a normal spot trade.
{% endhint %}

When you open the position Abyss automatically borrows the necessary amount and sells or buys based on the direction of the trade (Long or Short).  You can choose to unwind the position by clicking to the right of the positions tab (this action sells all of the bought asset for the debt asset and repays the debt to deleverage your position).

If any dust remains you can always repay the leftover debt with the repay debt button in the margin account info.

#### Managing Positions

View your open positions in the **Positions** tab below the chart. Each position shows:

* Entry price
* Current price
* Position size
* Unrealized PNL
* Liquidation price

**Adjusting Collateral**:

* **Add Collateral**: Deposit more assets to increase your risk ratio
* **Withdraw Collateral**: Remove excess collateral (only when risk ratio > 2.0)

<figure><img src="https://21702300-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl3ISq3b5D0pJQwrCHpTo%2Fuploads%2FDSj7XEBOBB5O7z2RstsK%2FScreenshot%202026-01-22%20at%201.36.20%E2%80%AFPM.png?alt=media&#x26;token=3c87b976-0d73-4e9d-bf5f-94aa2b2f6cae" alt=""><figcaption></figcaption></figure>

#### Closing a Position

**Method 1: Unwind**

* Click "Unwind" on your position
* The system automatically sells to close and repays borrowed amounts

**Method 2: Manual Close**

* Place an opposite order (sell if you're long, buy if you're short)
* Repay any remaining debt using the Repay modal

#### Order Management

**View Orders**: Check the "Open Orders" tab for active orders

**Cancel Orders**:

* Click "Cancel" on individual orders, or
* Use "Cancel All" to cancel all open orders

**Modify Orders**:

* Adjust quantity for limit orders
* Update leverage settings

***

### Limit orders and margin

Limit orders work very similarly to spot with the addition of margin. Your order will sit on the book with borrowed funds waiting to be executed at the predefined price. Once it executes the position will show up in the positions tab.&#x20;

{% hint style="info" %}
If you cancel a limit order the debt is not automatically repaid so you will need to manually repay the debt after.
{% endhint %}

Trade history and order history work in the same way as for spot trading.

### Risk Management

#### Best Practices

1. **Start with lower leverage**: Begin with 2x or 3x before using maximum leverage
2. **Monitor your risk ratio**: Keep it above 1.5 to avoid liquidation risk
3. **Use stop losses**: Protect against unexpected market moves
4. **Don't over-allocate**: Only trade with funds you can afford to lose
5. **Diversify margin managers**: Separate high-risk and low-risk strategies

#### Understanding Liquidation Risk

Your liquidation price is calculated based on:

* Your entry price
* Position size
* Leverage used
* Collateral deposited

**To avoid liquidation**:

* Add more collateral when risk ratio drops
* Partially close your position
* Set stop losses above liquidation price

#### Position Health Indicators

The interface shows color-coded risk status:

* **Green**: Healthy (risk ratio > 2.0)
* **Yellow**: Moderate (risk ratio 1.5 - 2.0)
* **Orange**: At risk (risk ratio 1.25 - 1.5)
* **Red**: Danger (risk ratio < 1.25)

***
