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

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

```
GET https://docs.gammaswap.com/markets-and-trading/margin.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.
