Skip to main content

REST API Trading - Close Position

Close Position

Written by Albert
Updated today

Close position

POST /frontoffice/api/v4/positions/{positionId}/close

Summary

Use this method to close a specific position entirely or partially.

Request

Header parameters

accountId required

The trading account identifier.

Path parameters

positionId required

The position identifier to close.

Body

closePositionLotAmount decimal string | nullable

The portion of the position to close, in lots.

Request example

POST /frontoffice/api/v4/positions/01K2PFXDP1FWCJSGTX4GJ6JHM0/close HTTP/1.1
Host: {host}
Authorization: Bearer JWT
accountId: {accountId}
Content-Type: application/json; x-api-version=4.0
Accept: */*

Response

In case of success, an object will be returned.

Each object contains the following information:

positionId string

The position identifier.

Response example β€” 200: OK

{
"positionId": "01K2PFXDP1FWCJSGTX4GJ6JHM0"
}

Did this answer your question?