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

# Perpetual Futures

MegaTAO perpetual futures are derivative contracts that track Alpha token prices. They never expire, allowing you to hold a position indefinitely (subject to funding costs, interest fees, and margin requirements).

## Positions

A position is an open trade representing exposure to an Alpha token price.

**Long position**: Profits when the Alpha token price goes up. You are buying exposure.

**Short position**: Profits when the Alpha token price goes down. You are selling exposure.

Each trader can hold one position per market. Position IDs are deterministically derived from the trader address and market address. A trader can hold up to 50 positions across different markets.

## Leverage

Leverage multiplies your position size relative to your margin.

| Leverage | Margin | Notional Value | Approx. Liquidation Move (at 10% maintenance) |
| -------- | ------ | -------------- | --------------------------------------------- |
| 1x       | 10 TAO | 10 TAO         | \~90% against you                             |
| 2x       | 10 TAO | 20 TAO         | \~40% against you                             |
| 3x       | 10 TAO | 30 TAO         | \~23% against you                             |
| 5x       | 10 TAO | 50 TAO         | \~10% against you                             |

Maximum leverage is 5x on all markets.

### How leverage affects P\&L

With 5x leverage:

* Price moves +10% --> your margin gains +50%
* Price moves -10% --> your margin loses -50%
* Price moves -10% --> liquidation (at 10% maintenance margin)

Leverage amplifies both gains and losses equally.

## Margin

Margin is the TAO collateral that backs your position.

### Initial margin

The margin required to open a position:

```
Initial Margin = Notional Value / Leverage
```

### Maintenance margin

The minimum margin ratio required to keep a position open. This is configured per-market (currently 10% on all markets, configurable from 1% to 50%).

If your margin ratio falls below the maintenance margin, the position is liquidated. See [Liquidations](/trading/liquidations.md).

### Margin ratio

```
Margin Ratio = (Margin + Unrealized P&L) / Notional Value
```

## Order execution

All positions are opened and closed via market orders. The order is first routed to the orderbook for matching. If no match is found, the protocol vault fills it.

Execution includes dynamic slippage based on position size and vault utilization:

| Vault Utilization | Base Slippage |
| ----------------- | ------------- |
| Normal            | 0.1%          |
| Medium            | 0.15%         |
| High              | 0.25%         |

Maximum slippage is capped at 20%. You set a `maxSlippage` parameter when opening a position, and the transaction reverts if actual slippage exceeds it.

A 0.25% trading fee is charged on the notional value of each trade (both open and close). See [Fees](/trading/fees.md).

## Closing positions

You can close a position at any time:

* **Full close:** Close the entire position
* **Partial close:** Close a portion of the position by specifying a notional amount

A position cannot be opened and closed in the same block (flash loan protection).


---

# 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.megatao.com/trading/perpetual-futures.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.
