# Collateral Framework

Zeta currently only accepts USDC as collateral. So users can only deposit and withdraw USDC from the system. All trades are settled and margined in USDC.

The following specifications are used in the margin system:

| Framework Element       | Specification                                                                                          |
| ----------------------- | ------------------------------------------------------------------------------------------------------ |
| Account Balance (AB)    | <p>USDC deposited in account. </p><p>Changes on deposit, withdrawal, position close and settlement</p> |
| Unrealized PnL (UP)     | Profit and loss from existing open positions, including unpaid funding                                 |
| Initial Margin (IM)     | Margin level required to open new orders                                                               |
| Maintenance Margin (MM) | Margin level required to maintain positions before liquidation                                         |

When a user places an order that adds to their existing position the initial margin requirements are checked. This is done to ensure that opening the position will not push the user into a state of bankruptcy - if this condition is violated users will (1) not be able to place an order, and (2) their existing open orders will be cancelled trustlessly. (3) Liquidators, when taking over a position must also pass this check:

$$
AB + UP - IM  +min(0, IPnL) > 0
$$

*where:*

* *AB = Account Balance*
* *UP = Unrealized PnL*
* *IM = Initial Margin x (Opening Orders + Positions)*
* *IPnL = instantaneous PnL from execution*

When a user places an order that closes an existing position the maintenance margin requirements (including open orders) are checked. This is done to ensure that the user has sufficient funds in their account to place an order and is not currently being liquidated.

$$
AB + UP - MM(O)  +min(0, IPnL) > 0
$$

*where:*

* *AB = Account Balance*
* *UP = Unrealized PnL*
* *MM (including open orders) = Maintenance Margin x (Opening Orders + Positions)*
* *IPnL = instantaneous PnL from execution*

The margin system also monitors a user's existing positions and orders to ensure that the user does not enter a state of bankruptcy:

$$
AB + UP - MM > 0
$$

*where:*

* *AB = Account Balance*
* *UP = Unrealized PnL*
* *MM = Maintenance Margin x (Positions)*

User withdrawals are also considered by the Zeta margin system ensuring that a withdrawal does not push a user into bankruptcy. As such withdrawals are limited to:

$$
AB + min(0, UPnL) - IM
$$

*where:*

* *UP = Unrealized PnL*
* *IM = Initial Margin x (Opening Orders + Positions)*

Orders that close a position are ***not*** charged margin.


---

# Agent Instructions: 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:

```
GET https://docs.zeta.markets/zeta-protocol/exchange-architecture/margin-system/collateral-framework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
