Positions
Split collateral into a complete binary pair and merge a held pair back into collateral.
Outcome tokens enter or leave your account through trading or two explicit position operations:
- Split locks collateral and mints one unit of each binary outcome per collateral unit.
- Merge burns equal quantities of both outcomes and returns collateral.
Every AGARA market is binary. Neg-risk events group binary member markets; a member uses the same split and merge paths as a standalone market.
| Endpoint | Authentication |
|---|---|
POST /trade/v1/portfolio/positions/split | PAT with positions:split |
POST /trade/v1/portfolio/positions/merge | PAT with positions:merge |
Split and merge are refused after a market is resolved. Supported standalone markets use automatic redemption after resolution.
Asynchronous lifecycle
Both endpoints return 201 with an account-batch hash:
Poll GET /trade/v1/batches/{batch_hash}. PENDING means only that the
request was accepted. Treat the operation as final at SETTLED; a failed
batch reverses provisional balance changes.
Operations queue per account and run in the order you started them, so a second
split, merge, or withdrawal is accepted while the first is still settling. The
queue has a limit; past it you get a 409 until one finishes.
Split
POST /trade/v1/portfolio/positions/split
collateral_amount_micro must be positive. 10000000 locks ten collateral
units and mints ten units of each outcome.
Merge
POST /trade/v1/portfolio/positions/merge
shares_micro is burned from each outcome. 5000000 burns five units of
both legs and returns five collateral units. Merge converts a complete pair at
one collateral unit per pair; it does not use the orderbook midpoint.
If you split 100 units and later sell 50 units of each outcome, the remaining 50-unit complete pair can be merged. A single unmatched outcome cannot be merged alone.
Merge everything
POST /trade/v1/portfolio/positions/merge-all
This browser-only endpoint merges the available smaller leg in every eligible
market. A 201 returns batch-group IDs; a 200 with an empty group_ids
array means nothing was mergeable.
Poll GET /trade/v1/batch-groups/{group_id} until completed_at is set. Each
chunk also carries a batch_hash readable through
GET /trade/v1/batches/{batch_hash}.
Errors
| Status | Action |
|---|---|
400 | Correct a non-positive amount or unknown condition ID |
401 | Send a valid token |
403 | Add the required split or merge scope |
404 | Complete AGARA wallet registration for this account |
409 | The queue is full, or a merge-all is settling; wait for one to finish |
422 | Reduce the amount, restore collateral/share coverage, or use a supported unresolved market |
424 | Finish wallet setup and signer authorization |
502 | Retry with backoff when the chain service is available |
503 | Position batches are not available on the deployment |
Cross-match settlement
Position tokens can also be created or burned when orders match:
| Match | Settlement |
|---|---|
| Same-outcome SELL and BUY | Normal token transfer |
| Complementary BUY orders | Mint a complete pair from both buyers' collateral |
| Complementary SELL orders | Merge the complete pair and return collateral |
The fill's settlement_mode reports the path. SELL orders always require and
reserve actual outcome shares; complementary BUY orders can create inventory
from collateral during a match.