> 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/trading/trading/perpetuals/positions.md).

# Positions

Position state: size, entry, unrealized and realized PnL, funding, and liquidation price.

A position is your open exposure in one market on the Nexus Exchange. The exchange's risk engine keeps live state for each position: entry price, size, collateral usage, funding, fees, and real-time profit and loss.

The engine recomputes position state on every mark update and every fill. There is no periodic cycle to wait for. See [Architecture](/overview/architecture.md).

### Open positions

`GET /positions` returns a `Position` per open market. The fields, and which of them are populated:

| Field                          | What it is                                                    | Populated?                                    |
| ------------------------------ | ------------------------------------------------------------- | --------------------------------------------- |
| `side`, `size`, `entryPrice`   | Direction, contracts, volume-weighted entry across fills      | Always                                        |
| `unrealizedPnl`, `realizedPnl` | PnL at the current mark, and PnL already booked               | Always                                        |
| `funding_paid`                 | Funding paid or received since opening                        | Always                                        |
| `notional`                     | `size × mark`                                                 | Unless the mark is unavailable                |
| `initialMargin`                | Collateral backing the position                               | Unless the mark or margin rate is unavailable |
| `roe`                          | `unrealizedPnl / initialMargin`, the return on initial margin | Unless an input is missing or margin is zero  |
| `liquidationPrice`             | The mark at which the engine liquidates                       | **`null` on this read**. See below            |
| `leverage`                     | Your leverage multiplier for this position                    | **Currently always `null`**                   |

Every nullable field has a matching `*_error` sibling carrying a machine-readable reason it is `null`, such as `liquidationPrice_error`, `initialMargin_error` and `roe_error`. Read the sibling rather than inferring from the absence.

**These are CCXT's unified names.** `Position` was renamed to use them, so a `ccxt.nexus()` client reads the venue without a translation layer. Fields with no CCXT counterpart keep the venue's own spelling: `size`, `roe`, `max_leverage`, `funding_paid`. `GET /account` keeps the venue's spelling too. It is relayed from the engine and returns a different, narrower shape.

All calculations follow the deterministic margin and funding rules enforced inside the exchange engine. The [Math Engine's position-tracker chapter](https://docs.nexus.xyz/math-engine/position-tracker) derives the position-state transitions: how a fill changes size and entry price, and how realized PnL is booked.

### Liquidation price is not on this read

`GET /positions` is served by the indexer, which does not mirror margin-module state. On that read `liquidationPrice` is `null` and `liquidationPrice_error` is always `margin_state_not_mirrored`.

Three ways to get the number:

* **`GET /account`** is relayed from the engine, which does hold margin state.
* **`POST /orders/preview`** returns `projected_post_trade_liquidation_price` for an order before you submit it.
* **Compute it.** For a single position the closed form is exact:

```
p_liquidation = (entry − direction × collateral / size) / (1 − direction × maintenance_margin_rate)
```

[Liquidations](/trading/trading/perpetuals/liquidations.md) derives this, works it through with real parameters, and explains why no per-position liquidation price exists for a cross-margin account holding several positions.

> **A `null` liquidation price means&#x20;*****not computed*****, not&#x20;*****cannot be liquidated*****.** A zero is a real price. A position that liquidates only at zero effectively cannot be liquidated, and the field no longer overloads `"0"` to mean absence. Do not derive leverage from `initialMargin`, because that collapses to `1 / initial_margin_rate`, a per-market constant.

### Modifying positions

You change a position by submitting orders. There is no separate position-mutation endpoint. Fills apply atomically in the matching engine.

* **Increase or reduce.** Submit an order on the same side to increase, the opposite side to reduce. Set `reduce_only: true` to guarantee an order can only shrink the position and never open the other side; the engine rejects it if it would.
* **Flip.** An opposite-side order larger than your position closes it and opens the remainder on the other side. Long 1 BTC, market sell 2 BTC, and you end up short 1 BTC, with the PnL on the closed 1 BTC realized at the fill prices.
* **Close.** Submit an opposite-side order for the full size. Realized PnL books immediately on the fill.
* **Amend.** `PATCH /orders/{order_id}` is an atomic cancel-replace on a resting order, so repricing does not require giving up your place in one call and racing to submit another.
* **History.** `GET /positions/pnl` for realized and unrealized PnL; `GET /fills` for the individual prints behind an entry price.

The tabs, modals and preset controls an interface offers on top of these operations are that interface's own choices, not part of the venue's contract.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
