POST /api/v1/market/positions/{market_id}/close
Close the authenticated user's position in a given market. This creates a market order to sell all held shares at the current best available price.
Authentication​
Required. Bearer token in Authorization header.
Request​
Path Parameters​
| Parameter | Type | Required | Description |
|---|---|---|---|
market_id | int64 | Yes | ID of the market to close the position in. |
Example​
curl -X POST https://intotes.com/api/v1/market/positions/42/close \
-H "Authorization: Bearer <token>"
Response​
200 OK​
{
"message": "Position closed successfully"
}
The shares are sold at the current market price (via the orderbook and/or LMSR AMM), and the proceeds are credited to the user's balance.
Errors​
| Status | Code | Description |
|---|---|---|
| 404 | POSITION_NOT_FOUND | No open position found for this user in the market. |
| 409 | MARKET_PAUSED | The market is currently paused for trading. |