Close Positions
API URL: POST https://gateway-api-demo.s2f.projectx.com/api/Position/closeContract
API Reference: /api/position/closeContract
Description
Close a position.
Parameters
Name | Type | Description | Required | Nullable |
---|---|---|---|---|
accountId | integer | The account ID. | Required | false |
contractId | string | The contract ID. | Required | false |
Example Usage
Example Request
- cURL Request
curl -X 'POST' \
'https://gateway-api-demo.s2f.projectx.com/api/Position/partialCloseContract' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"accountId": 536,
"contractId": "CON.F.US.GMET.J25",
"size": 1
}'
Example Response
- Success
- Error
{
"success": true,
"errorCode": 0,
"errorMessage": null
}
Error: response status is 401