# Settlement

When you trade on SYMMIO, your positions earn or lose money over time. That profit or loss is called unrealized PnL. It exists on paper, but it isn’t yet locked in as realized PnL. Separately, you also have an allocated balance: real collateral that can be used to pay for losses, open new positions, or be withdrawn. The protocol requires this allocated balance to remain sufficient at all times, which means you can’t close a losing trade unless you have enough realized collateral to cover the loss. Sometimes a trader is profitable overall but still gets blocked from closing a losing position, because all of those profits are still unrealized inside open positions. Settlement is the mechanism that converts some of those unrealized gains into usable balance.

Let's illustrate settling unrealized profit works with an example:

### How it works

Let's say **Bob** has three open positions:

1. **Position 1** with **Rasa Hedger**: unrealized profit of **$300**
2. **Position 2** with **PerpsHub Hedger**: unrealized profit of **$100**
3. **Position 3** with **PerpsHub Hedger**: unrealized loss of **$250**

Bob is $150 in profit overall, and wants to close Position 3. But his allocated balance is too low to cover the $250 loss.

The solver steps in: PerpsHub submits a signed message from the Muon oracle attesting to current market prices and the unrealized profits/losses across Bob's positions. The contract verifies the signature, checks that everyone stays solvent, and settles. After settlement, $100 from Position 2 and $150 from Position 1 are realized into Bob's allocated balance. Bob now has $250 of spendable collateral, and PerpsHub can close the losing position. Nobody takes on uncollateralized risk, and Bob isn't stuck waiting for the trade to recover.\
\
Position 3 remains unchanged, and PerpsHub can now successfully fill the close request for Position 3, as Bob has sufficient allocated balance ($250) to cover the loss ($250).

Now Bob has $250 of spendable collateral, and PerpsHub can safely close the losing position. Nothing in the system breaks, no one takes on uncollateralized risk, and Bob isn’t trapped waiting for his losing trade to recover.

In previous versions, settlement only dealt with position PnL. In 0.8.5, settlement also handles accumulated funding fees. When a solver settles your positions, both position PnL and any owed funding are factored in together.

This settlement process has several important protections built in. The updated prices must always lie between the original entry price and the signed current price, neither side of the trade is allowed to end up insolvent as a result of settlement and multiple positions can be settled at once, allowing a solver to quickly free up collateral across many trades if needed. More details on settlement can be found [here](/contract-documentation/symmio-perps-v0.8.4/facets/settlement-facet-0.8.4.md).


---

# 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.symm.io/trader-documentation/how-trading-works-in-symmio/settlement.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.
