Skip to main content

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


NameTypeDescriptionRequiredNullable
accountIdintegerThe account ID.Requiredfalse
contractIdstringThe contract ID.Requiredfalse
typeintegerThe order type:
1 = Limit
2 = Market
4 = Stop
5 = TrailingStop
6 = JoinBid
7 = JoinAsk
Requiredfalse
sideintegerThe side of the order:
0 = Bid (buy)
1 = Ask (sell)
Requiredfalse
sizeintegerThe size of the order.Requiredfalse
limitPricedecimalThe limit price for the order, if applicable.Optionaltrue
stopPricedecimalThe stop price for the order, if applicable.Optionaltrue
trailPricedecimalThe trail price for the order, if applicable.Optionaltrue
customTagstringAn optional custom tag for the order. Must be unique across the account.Optionaltrue
stopLossBracketobjectStop loss bracket configuration.Optionaltrue
takeProfitBracketobjectTake profit bracket configuration.Optionaltrue

Bracket Objects

stopLossBracket

NameTypeDescriptionRequiredNullable
ticksintegerNumber of ticks for stop lossRequiredfalse
typeintegerType of stop loss bracket. Uses same OrderType enum values:
1 = Limit
2 = Market
4 = Stop
5 = TrailingStop
6 = JoinBid
7 = JoinAsk
Requiredfalse

takeProfitBracket

NameTypeDescriptionRequiredNullable
ticksintegerNumber of ticks for take profitRequiredfalse
typeintegerType of take profit bracket. Uses same OrderType enum values:
1 = Limit
2 = Market
4 = Stop
5 = TrailingStop
6 = JoinBid
7 = JoinAsk
Requiredfalse

Example Usage


Example 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

{
"orderId": 9056,
"success": true,
"errorCode": 0,
"errorMessage": null
}