> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aultblockchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Clearing

> How an order becomes a final balance change, and how to confirm it.

> [!NOTE]
>
> Mainnet currently supports Spot DEX only. Perpetuals, Oracle, Margin Trading, Lending, and Vaults are **Testnet-Only**. Use Testnet endpoints and assets for those products.

Clearing is how an accepted order becomes a final balance change: funds are reserved, fills are applied, fees are charged, and unused funds are released.

## What each confirmation means

| What you see | What it means |
| - | - |
| Transaction accepted by a node | The transaction was received. It has not executed yet. |
| Order accepted or resting | The order passed its checks at that moment. A later match can still fail risk checks. |
| Fill committed in a finalized block | The trade and its settlement are final. |
| REST or WebSocket update received | The API reported indexed data, which can lag behind the chain. |

## Reservations and settlement

1. **Each product reserves something different.** Spot holds the asset you pay. Margin Trading reserves Lending collateral. Perpetual orders use order margin.
2. **Only successful fills change balances.** Matching first proposes a fill, then the product runs its settlement checks. If those checks reject it, no fill happens and no funds are credited.
3. **A cancel never reverses a fill.** Canceling or expiring an order releases only the unfilled part.

On Spot, the amount you receive is rounded down to the smallest token unit on each fill. Many small fills can therefore credit slightly less than one calculation on the total.

## PnL and balance changes

A Spot fill exchanges one asset for another. Closing a Perpetual position adds its realized PnL to your collateral.

For example, closing 4 units of a long entered at 100 at a price of 120 realizes `4 * (120 - 100) = 80` in the quote currency, before fees and funding.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.