> For the complete documentation index, see [llms.txt](https://docs.reya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reya.xyz/developers/devnet/executions-and-settlement/settlement.md).

# Trade Settlement

Reya matches orders off-chain and settles trades on Reya Network. For your integration, the key distinction is between an order being matched and its fills being confirmed.

## The two stages

1. **Match.** Reya validates your signed order and matches it against available liquidity. The order-submission response and [`orderChanges`](/developers/devnet/api-reference/websocket-api-reference.md) report the order outcome, including any matched quantity.
2. **Settlement.** Each fill is validated and settled on-chain. Confirmed trades appear on `spotExecutions` or `perpExecutions`; failed settlements appear on `executionBusts`.

{% hint style="warning" %}
**A successful match is not a settled trade.** Use the executions channels to confirm which fills settled before updating your trade ledger.
{% endhint %}

## Checks performed by Reya

Reya verifies signatures and signer permissions, order validity, nonces, balances, margin, price limits and applicable market rules. Each matched fill must also pass settlement checks against the current account and market state.

You submit signed order-management requests through [REST](/developers/devnet/api-reference/rest-api-reference.md) or [WebSocket Order Entry](/developers/devnet/api-reference/ws-exec-api-reference.md). Reya handles settlement; you do not submit a separate settlement transaction for your fills.

## When is a trade final?

Once a fill appears on `spotExecutions` or `perpExecutions`, it has **settled on Reya Network and will not be busted**. Use the channel for the product you trade. The unified `executionBusts` channel reports failed settlements for both spot and perp.

## When settlement fails

Account balances, margin and prices can change between matching and settlement. A fill may fail settlement if it falls outside the permitted price band, a required price is stale, margin is insufficient, or a GTT order's signed `expiresAfter` has passed. The request-signing `deadline` is checked at entry; it is separate from the order's settlement expiry.

A failed settlement is reported as a **trade bust**: the failed fill does not change your settled position. It does not undo other fills that settled successfully. See [Trade Busts](/developers/devnet/executions-and-settlement/trade-busts.md) for how to reconcile the outcome.

## What this means for your integration

* **Drive your trade ledger from `spotExecutions` and `perpExecutions`.** The order-submission response and `orderChanges` report matching outcomes before settlement.
* **Reconcile each fill independently.** An order can produce multiple fills, some of which settle while others bust.
* **De-duplicate execution events.** Use `(channel, sequenceNumber)` as the idempotency key. See [Executions & Trade History](/developers/devnet/executions-and-settlement/executions-and-trade-history.md) for identifiers, pagination and reconnect recovery.
