Closing Positions
You can close an open position at any time before the event resolves. Closing converts your token holdings back into balance at the current market price. Alternatively, positions are settled automatically when the event outcome is determined.
Manual Closeβ
Endpointβ
POST /api/v1/market/positions/{market_id}/close
Authorization: Bearer <token>
Replace {market_id} with the UUID of the market whose position you want to close.
How It Worksβ
When you close a position, the system creates a market order on your behalf:
- Long position (holding YES tokens): A sell market order is created to sell all your YES shares at the best available bid price.
- Short position (holding NO tokens): A buy market order is created to buy back NO shares, effectively closing out your exposure.
The created order goes through the same matching engine as any other market order. It executes at the best available prices in the orderbook and is subject to the same fees.
Exampleβ
curl -X POST https://api.intotes.com/api/v1/market/positions/100/close \
-H "Authorization: Bearer eyJhbG..."
Important Considerationsβ
- Slippage: Since the close creates a market order, the execution price depends on available liquidity. In thin orderbooks, you may experience slippage (worse price than expected).
- Partial execution: If there is insufficient liquidity to fill the entire position, the resulting order may only partially fill. The remaining position stays open.
- Fees apply: The same trading fees are charged on the close order as on any other trade.
Settlement at Resolutionβ
When an event reaches its resolution (the outcome is determined), all open positions in that event's markets are automatically settled:
- Winning tokens (e.g., YES tokens when the outcome is YES) pay out 10000 cents (100%) per share.
- Losing tokens pay out 0 cents per share.
Settlement happens automatically -- no action is required from the trader. The realized PnL is calculated and the balance is credited or debited accordingly.
Settlement vs. Manual Closeβ
| Aspect | Manual Close | Settlement |
|---|---|---|
| Timing | Any time before resolution | At event resolution |
| Price | Current market price | 10000 (winner) or 0 (loser) |
| Fees | Trading fees apply | No trading fees |
| Certainty | Depends on market liquidity | Guaranteed execution |
| Strategy | Lock in profit or cut losses early | Hold to resolution for maximum payout (if correct) |
Manual close is useful when:
- You want to take profit before the event resolves (the price has moved in your favor).
- You want to cut losses (the market has moved against you and you expect it to get worse).
- You want to free up capital for other trades.
Holding to settlement is preferable when:
- You are confident in the outcome and want the full 10000 payout per share.
- The current market price does not reflect your conviction.
Viewing Closed Positionsβ
After a position is closed (manually or via settlement), it appears in the completed positions history:
GET /api/v1/market/positions/completed
Authorization: Bearer <token>
The response returns ClosedPositionWithDetails objects containing:
| Field | Description |
|---|---|
market_id | The market the position was in. |
token_type | "YES" or "NO". |
amount | Number of shares that were held. |
avg_price | Average acquisition price. |
pnl | Realized profit or loss in cents. |
won_side | The winning outcome ("YES" or "NO"). Present only for settled positions. |
event_name | Name of the parent event. |
pool_name | Pool name. |
market_name | Market name. |
closed_at | Timestamp of closure. |
See Alsoβ
- Positions and PnL -- Understanding open positions and unrealized PnL
- Order Types -- The market orders generated by position close
- Matching Engine -- How the close order is matched
- Fees and Commissions -- Fees on manual close trades