# Unified Margin

*Added as part of the unified margin rollout.*

Unified margin is a generalization of cross margin across spot and per assets. Pacifica users' account's USDC balance, unrealized PnL, and spot holdings are margined together in a unified account.

### Account equity

```
equity_without_spot = usdc_balance + unrealized_pnl_from_cross_perps - pending_interest
account_equity      = equity_without_spot + spot_collateral_value
```

`pending_interest` is interest that has accrued on outstanding borrows but has not yet been settled against the USDC balance. It is deducted from equity the moment it accrues. See [Money Market](https://pacifica.gitbook.io/docs/trading-on-pacifica/money-market).

Spot collateral value is computed per asset using a piecewise curve based on LTV ratio, a per-user collateral cap, and an optional hedging bonus for delta-neutral positions. See [Spot Collateral](https://pacifica.gitbook.io/docs/trading-on-pacifica/spot-collateral).

### Implicit borrowing

Pacifica's implicit borrowing mechanism allows for greater capital efficiency when spot assets are used as margin for perpetual positions. Perp positions can be opened against spot margin with no initial borrow.

The exception to this is isolated perp positions, where then entire margin required is borrowed upfront upon the position being opened.

An account is treated as a borrower whenever `equity_without_spot < 0`. The shortfall `required_borrow = max(0, -equity_without_spot)` is covered implicitly by the money market. This can happen because the USDC balance goes negative, cross perp losses exceed USDC, or accrued interest pushes equity below zero. Interest accrues on the outstanding amount from that point. No user action is required, and no explicit borrow transaction is submitted.

Implicit borrowing only proceeds if the account holds enough spot collateral to cover the borrow under effective LTV. An account without adequate spot collateral is flagged for deleveraging. See [Liquidations](https://pacifica.gitbook.io/docs/liquidations#spot-insolvency-deleveraging).

### Carry and hedged positions

Because spot and perpetual PnL are netted in a single equity figure, a long spot position paired with a short perpetual on the same underlying functions as a carry trade without requiring the user to collateralize each leg separately. The matched portion of the hedge also receives an elevated LTV rate. See [Spot Collateral](https://pacifica.gitbook.io/docs/trading-on-pacifica/spot-collateral).

### Exceptions to Unified Margin

* A spot asset can be excluded from unified margin at the account level by setting `unified_margin_excluded` (this can be done on the portfolio page). The balance remains usable for spot trading but contributes zero collateral for perpetual margining.
* Assets with `collateral_enabled = false` never contribute collateral regardless of account settings. (currently all spot assets contribute collateral)

### Sub-accounts

Sub-accounts are margined independently. Spot collateral and USDC held in a sub-account back only that sub-account's positions. Assets can be moved between a master account and its direct sub-accounts via [subaccount spot transfers](https://pacifica.gitbook.io/docs/deposits-and-withdrawals#subaccount-spot-transfers).


---

# 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://pacifica.gitbook.io/docs/trading-on-pacifica/unified-margin.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.
