Skip to main content

Placing Your First Order

This documentation outlines the process for placing your first order using our API. To successfully execute an order, you must have an active trading account associated with your user. Follow the steps below to retrieve your account details, browse available contracts, and place your order.

Step 1

To initiate the order process, you must first retrieve a list of active accounts linked to your user. This step is essential for confirming your account status before placing an order.

API URL: POST https://gateway-api-demo.s2f.projectx.com/api/account/search

API Reference: /api/account/search

{
"onlyActiveAccounts": true
}

Step 2

Once you have identified your active accounts, the next step is to retrieve a list of contracts available for trading. This information will assist you in choosing the appropriate contracts for your order.

API URL: POST https://gateway-api-demo.s2f.projectx.com/api/contract/search

API Reference: /api/contract/search

{
"live": false,
"searchText": "NQ"
}

Final Step

Having noted your account ID and the selected contract ID, you are now ready to place your order. Ensure that you provide accurate details to facilitate a successful transaction.

API URL: POST https://gateway-api-demo.s2f.projectx.com/api/order/place

API Reference: /api/order/place

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.Optionaltrue
linkedOrderIdintegerThe linked order id.Optionaltrue
{     
"accountId": 1,
"contractId": "CON.F.US.DA6.M25",
"type": 2,
"side": 1,
"size": 1,
"limitPrice": null,
"stopPrice": null,
"trailPrice": null,
"customTag": null,
"linkedOrderId": null
}