> For the complete documentation index, see [llms.txt](https://docs.defx.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.defx.com/docs/trade/defx-perp-dex/margin.md).

# Margin

### Initial Margin

Initial Margin represents the required collateral (expressed in USD) needed to initiate a long or short position on Defx. The amount of Initial Margin is directly influenced by the leverage applied to the position; using higher leverage decreases the amount of Initial Margin required to open the position.&#x20;

Initial Margin on Defx is calculated as:

$$
InitialMargin = ContractSize\*EntryPrice / Leverage
$$

### Maintenance Margin

Maintenance Margin is the minimum margin requirement (expressed in USD) essential for keeping a position open. This margin is dynamically calculated across various notional value tiers (as outlined in the contract specifications), where the notional value is determined by multiplying the contract size by the entry price. Essentially, as the size of your position increases, so does the required Maintenance Margin.

It's crucial to understand that the Maintenance Margin plays a significant role in determining the liquidation price of your position. To safeguard against liquidation, traders are advised to proactively manage their positions, ensuring their collateral does not drop below the Maintenance Margin requirement.

In Defx, the maintenance Margin is calculated using the following formula.

$$
Maintenance Margin = Notional Position Value \* Maintenance Margin Rate - Maintenance Amount
$$

### **Supported Margin Modes**

#### Current: Isolated Margin

Currently, Defx supports trading in **Isolated Margin** mode. This approach allows you to allocate a specific portion of your capital as margin for each trade individually. It means that if one of your positions is subject to liquidation due to market movements, only the margin allocated to that specific position is at risk. The margins of your other open positions remain secure and unaffected, ensuring that your trading strategy is compartmentalized and your risk is contained.

#### **Upcoming: Cross Margin**

**Cross Margin** trading is on our development roadmap and will be introduced soon. Cross Margin trading will enable you to utilize the full balance of your account to manage margin requirements across all open positions. This method provides greater flexibility in balancing risks and leveraging opportunities across your portfolio.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.defx.com/docs/trade/defx-perp-dex/margin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
