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

# Close & Settle

> Close a Hedge early or let it settle at maturity, then review the outcome.

A Hedge ends in one of two ways: you close it early, or it settles automatically at maturity. Both return your margin plus net P\&L, net of carry and fees, to your USDC balance. Closed Hedges are then available in your history with realized figures.

## Close early

Close the position by market and side. Closing is asynchronous: it returns `status: "submitted"` with an `order_tx_hash` and fills shortly after. `GET /positions` returns to flat once it drains.

| Field    | Type   | Required | Description                                          |
| -------- | ------ | -------- | ---------------------------------------------------- |
| `market` | string | Yes      | e.g. `USDTNGN`.                                      |
| `side`   | string | Yes      | `buy` or `sell` - the side of the position to close. |

<Info>
  Pass an `Idempotency-Key` so the close is safe to retry. See [API Conventions](/guides/api-conventions#idempotency).
</Info>

```bash theme={null}
curl -X POST "$BASE_URL/hedges/close" \
  -H "Authorization: Bearer $MARKS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"market":"USDTNGN","side":"sell"}'
```

Poll `GET /positions` until the side is gone to confirm the close has drained.

## Settle at maturity

If you hold a Hedge to its `maturity_at`, it settles automatically against the Marks reference rate - you don't need to call close. The outcome lands in your USDC balance and the Hedge moves to `closed`. To carry the exposure further, open a new Hedge at a fresh tenor.

## Review history

`GET /hedges/history` lists closed Hedges with their realized economics.

```bash theme={null}
curl "$BASE_URL/hedges/history" \
  -H "Authorization: Bearer $MARKS_API_KEY"
```

| Field                        | Description                                                             |
| ---------------------------- | ----------------------------------------------------------------------- |
| `entry_price` / `exit_price` | The rate opened at, and the rate closed or settled at.                  |
| `exit_type`                  | `closed`, `liquidated`, `take_profit`, `stop_loss`, or `partial_close`. |
| `gross_pnl_usd`              | Realized price P\&L, before carry and fees.                             |
| `net_pnl_usd`                | Realized P\&L net of carry and fees.                                    |
| `carry_usd`                  | Net carry over the hold, signed (positive earned, negative paid).       |
| `fees_usd`                   | Total fees paid.                                                        |

`net_pnl_usd` is the bottom line for a closed Hedge: what the position earned or cost you after everything.
