Skip to main content
POST
Close one position on an account

Authorizations

X-API-Key
string
header
required

Organization API key. Format: "hp_live_{key}". Organization admins manage the key in the dashboard.

Path Parameters

accountId
string
required

Trading account ID

contract
string
required

Contract symbol of the open position, as on the positions read and the real-time stream

Pattern: ^[A-Za-z0-9._-]{1,40}$

Body

application/json
reason
string
required

Why the position is being closed. Recorded on the resulting orders and on the account's event log.

Required string length: 3 - 200
Example:

"Risk review"

quantity
integer

How much to close, in the position's units (futures: contracts; perpetuals: units of the contract's quantityStep, as quantity on the positions read). Omit to close the whole position.

Required range: 1 <= x <= 4294967295
Example:

1

Response

Position closed (wholly or in part)

success
boolean
Example:

true

data
object