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

# Margin

## Description

Margin is the amount of USD posted as collateral to open and maintain open a position. All open positions and resting limit orders are fully collateralized. Opposite side orders do not offset each other's margin requirement. This prevents the margin exchange from having to liquidate orders and ensure full payout to the winner of the contract as one trader's profit is an opposing trader's margin. Therefore, losses for a position are capped at margin and percent returns are measured against margin. Since all open positions are fully collateralized, there are no margin calls.

## Formula

The formula for calculation of the margin requirement of an order is as follows\
$$longMargin = round Up (C \* P)$$\
$$shortMargin = round Up (C \* (1 - P))$$

Where

*C = number of contracts*\
*P = average price of position or limit price of resting limit order*\
*roundUp = margin is rounded up to the nearest centicent*

## Reduce Only Orders

To post a resting limit order a user needs to have enough USD in his wallet to post margin. However, marketable orders that offset an existing position (i.e. an order that immediately reduces a position) use the existing position to offset the margin requirement.

## Minimum Margin

The minimum margin requirement for submitting an order is 0.1 cent. Orders that require a margin amount below this level will be rejected.


---

# 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.gammaswap.com/markets-and-trading/margin.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.
