v1

latestOpenAPI 3.0.12026-07-26171200932.8 KB
Trading - Real

Close position by units

Rate limit: 20 requests per 60 seconds. This is a shared quota — the same budget is consumed by a group of related endpoints, so calling any of them reduces what is left for the others (you cannot call each at the full rate independently). Endpoints sharing this quota:

  • DELETE /api/v1/trading/execution/limit-orders/{orderId}
  • DELETE /api/v1/trading/execution/market-close-orders/{orderId}
  • DELETE /api/v1/trading/execution/market-open-orders/{orderId}
  • DELETE /api/v2/trading/execution/orders/{orderId}
  • POST /api/v1/trading/execution/limit-orders
  • POST /api/v1/trading/execution/market-open-orders/by-amount
  • POST /api/v1/trading/execution/market-open-orders/by-units
  • POST /api/v2/trading/execution/orders

This endpoint allows traders to close an entire position or a portion of it at the current market rate. If UnitsToDeduct is provided, only the specified portion will be closed. If UnitsToDeduct is omitted or set to null, the full position will be closed.

post/api/v1/trading/execution/market-close-orders/positions/{positionId}

Path parameters

positionIdinteger required

The unique identifier of the position to close.

Headers

x-request-idstring uuid required
Example:521660b2-6c72-44b0-8d62-ee64eaa40738

A unique request identifier.

x-api-keystring password required
Example:lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663

API key for authentication.

x-user-keystring password required
Example:eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_

User-specific authentication key.

Request body

InstrumentIdinteger required

The ID of the financial instrument associated with the position.

UnitsToDeductnumber double nullable

The number of units to close. If omitted or null, the entire position will be closed.

Response

Successfully closed a position or a part of it.

tokenstring uuid

A unique confirmation token for the closing order.