Place an Order
API URL: POST https://gateway-api-demo.s2f.projectx.com/api/Order/place
API Reference: /api/Order/place
Description
Place an order.
Parameters
| Name | Type | Description | Required | Nullable |
|---|---|---|---|---|
| accountId | integer | The account ID. | Required | false |
| contractId | string | The contract ID. | Required | false |
| type | integer | The order type: 1 = Limit 2 = Market 4 = Stop 5 = TrailingStop 6 = JoinBid 7 = JoinAsk | Required | false |
| side | integer | The side of the order: 0 = Bid (buy) 1 = Ask (sell) | Required | false |
| size | integer | The size of the order. | Required | false |
| limitPrice | decimal | The limit price for the order, if applicable. | Optional | true |
| stopPrice | decimal | The stop price for the order, if applicable. | Optional | true |
| trailPrice | decimal | The trail price for the order, if applicable. | Optional | true |
| customTag | string | An optional custom tag for the order. Must be unique across the account. | Optional | true |
| stopLossBracket | object | Stop loss bracket configuration. | Optional | true |
| takeProfitBracket | object | Take profit bracket configuration. | Optional | true |
Bracket Objects
stopLossBracket
| Name | Type | Description | Required | Nullable |
|---|---|---|---|---|
| ticks | integer | Number of ticks for stop loss | Required | false |
| type | integer | Type of stop loss bracket. Uses same OrderType enum values: 1 = Limit 2 = Market 4 = Stop 5 = TrailingStop 6 = JoinBid 7 = JoinAsk | Required | false |
takeProfitBracket
| Name | Type | Description | Required | Nullable |
|---|---|---|---|---|
| ticks | integer | Number of ticks for take profit | Required | false |
| type | integer | Type of take profit bracket. Uses same OrderType enum values: 1 = Limit 2 = Market 4 = Stop 5 = TrailingStop 6 = JoinBid 7 = JoinAsk | Required | false |
Example Usage
Example Request
- cURL Request
curl -X 'POST' \
'https://gateway-api-demo.s2f.projectx.com/api/Order/place' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"accountId": 465,
"contractId": "CON.F.US.DA6.M25",
"type": 2,
"side": 1,
"size": 1,
"limitPrice": null,
"stopPrice": null,
"trailPrice": null,
"customTag": null,
"stopLossBracket": {
"ticks": 10,
"type": 1
},
"takeProfitBracket": {
"ticks": 20,
"type": 1
}
}'
Example Response
- Success
- Error
{
"orderId": 9056,
"success": true,
"errorCode": 0,
"errorMessage": null
}
Error: response status is 401