> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/exchange/trading/perpetuals/margining.md).

# Margining

Margining on the Nexus Exchange will be executed natively inside NexusCore.&#x20;

### **Initial Margin Requirements**

When opening a leveraged position, traders must post initial margin, defined by the maximum leverage allowed for a given market.

Initial margin ensures sufficient collateral at entry and will be verified atomically by NexusCore before an order is accepted into the orderbook. The initial margin calculation will follow the formula:

$$
initial\_margin=position\_size×mark\_priceleverageinitial\_margin=leverageposition\_size×mark\_price​
$$

Because margin validation will run inside NexusCore, traders will benefit from:

* **Deterministic enforcement** (no race conditions from asynchronous contract calls)
* **Sub-second execution** aligned with block times
* **Atomic settlement** with order placement

This will ensure both speed and safety at the protocol level.

### **Maintenance Margin**

Maintenance margin is the minimum margin that must be preserved to keep a position open. Falling below this threshold makes a position eligible for liquidation. Each market will have its own maintenance margin fraction, calculated as:

$$maintenance\_margin=1max\_leverage×2maintenance\_margin=max\_​leverage×21​$$

### **Liquidation Process**

Positions will be liquidated when the mark price from the oracle causes equity to fall below maintenance margin.&#x20;

<br>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/exchange/trading/perpetuals/margining.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
