> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.drazill.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.drazill.com/_mcp/server.

# Complete-set redemption

A **complete set** is one share of *every* outcome in a market: `YES` + `NO` on a binary
market, or all N legs of a categorical one. Exactly one outcome resolves to `$1.00` and the
rest to `$0.00`, so holding a complete set pays exactly **\$1 per set at resolution, whatever
the result** — the payout does not depend on which outcome wins.

Because that value is certain, it does not have to wait for resolution.
`POST /orders/merge-positions` burns a complete set out of your positions and credits `$1`
per set to your wallet immediately.

> **Note**
>
> This is a **position transformation, not a trade.** Nothing is priced, nothing crosses the
> book, and no counterparty is involved.

## What the endpoint does

Call it with a market id. The service takes the minimum share count across all of that
market's outcomes, floors it to whole cents, burns that many shares from every outcome, and
credits the same number of dollars.

```json
POST /api/v1/orders/merge-positions
{ "market_id": "1e7a…" }
```

```json
{
  "market_id": "1e7a…",
  "sets_merged": "60.00",
  "amount_credited": "60.00",
  "outcomes_reduced": [
    { "outcome_id": "…", "outcome_name": "YES", "shares_burned": "60.00" },
    { "outcome_id": "…", "outcome_name": "NO",  "shares_burned": "60.00" }
  ]
}
```

Holding 100 `YES` and 60 `NO` merges **60 sets** for **\$60.00**, leaving 40 `YES` and 0 `NO`.
The remaining 40 `YES` is a normal directional position and is untouched.

## Properties you can rely on

| Property            | What it means                                                                                                                                                    |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **\$1 per set**     | The credit is `sets × $1.00`. There is no quote and no spread — the amount is an identity, not a price.                                                          |
| **No fee**          | Merging is not a trade, so no maker/taker fee is charged and no fee row appears on the ledger.                                                                   |
| **No price impact** | Only your positions and your wallet move. The market's LMSR state (`amm_shares`) and every displayed outcome price are untouched, so merging cannot move a mark. |
| **Cent-exact**      | Sets are floored to whole cents, so the shares burned equal the dollars paid exactly. A sub-cent remainder stays in your position.                               |
| **Idempotent**      | The set is recomputed under lock on each call. Once merged it is gone, so a repeated call redeems `0` and credits nothing — a retry can never double-pay.        |
| **Balanced**        | The credit is a double-entry journal against the market settlement pool, which already holds the offsetting liability. Nothing is minted.                        |

## When there is nothing to merge

The call succeeds with `sets_merged: "0.00"` — it is not an error — whenever you do not hold
a complete set: a position missing on any outcome, or a minimum below one cent. Partial
coverage of a categorical market (three legs of a five-way race) is **not** a set.

A resolved or cancelled market rejects the call: there is nothing left to redeem early.

## Availability

Complete-set redemption is a **flagged capability** (`POSITION_MERGE_ENABLED`). Where it is
not enabled, `POST /orders/merge-positions` returns `404 Not Found` like any route that does
not exist in that environment. Check the endpoint against your target environment before
building a flow around it, and treat the `404` as "not available here", not as a failure of
your request.

Merging requires the `orders:write` scope.