v1

latestOpenAPI 3.0.32026-07-2613529376.3 KB
Collateral Trading

Close Position

The endpoint closes an open collateral position at the current market price. The system places a market order in the opposite direction to fully close the specified position. Any attached take-profit or stop-loss orders are cancelled automatically.

<Warning> Rate limit: 10000 requests/10 sec. </Warning> <Accordion title="Error Codes"> - `30` - default validation error code (for example, a missing or malformed `positionId` or `market`) - `104` - position not found. Returned whether the `positionId` does not exist, the position is already closed, or it is not owned by the account — these cases are not distinguished - `10` - insufficient balance to fund the closing market order </Accordion>
post/api/v4/collateral-account/position/close

Request body

positionIdinteger required

Unique identifier of the position to close. Obtain from the open positions endpoint.

positionSide'LONG' | 'SHORT' | 'BOTH'

Defines the position direction when hedge mode is enabled. See positionSide

marketstring required

Market of the position to close. Example: BTC_USDT

requeststring required
nonceinteger required

Example request

{
  "positionId": 123,
  "positionSide": "LONG",
  "market": "BTC_USDT",
  "request": "{{request}}",
  "nonce": 1594297865000
}

Response

Position closed