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
- Request
- Response
- cURL Request
{
"onlyActiveAccounts": true
}
{
"accounts": [
{
"id": 1,
"name": "TEST_ACCOUNT_1",
"canTrade": true,
"isVisible": true
}
],
"success": true,
"errorCode": 0,
"errorMessage": null
}
curl -X 'POST' \
'https://gateway-api-demo.s2f.projectx.com/api/Account/search' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"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
- Request
- Response
- cURL Request
{
"live": false,
"searchText": "NQ"
}
{
"contracts": [
{
"id": "CON.F.US.ENQ.H25",
"name": "ENQH25",
"description": "E-mini NASDAQ-100: March 2025",
"tickSize": 0.25,
"tickValue": 5,
"activeContract": true
},
{
"id": "CON.F.US.MNQ.H25",
"name": "MNQH25",
"description": "Micro E-mini Nasdaq-100: March 2025",
"tickSize": 0.25,
"tickValue": 0.5,
"activeContract": true
},
{
"id": "CON.F.US.NQG.G25",
"name": "NQGG25",
"description": "E-Mini Natural Gas: February 2025",
"tickSize": 0.005,
"tickValue": 12.5,
"activeContract": true
},
{
"id": "CON.F.US.NQM.G25",
"name": "NQMG25",
"description": "E-Mini Crude Oil: February 2025",
"tickSize": 0.025,
"tickValue": 12.5,
"activeContract": true
}
],
"success": true,
"errorCode": 0,
"errorMessage": null
}
curl -X 'POST' \
'https://gateway-api-demo.s2f.projectx.com/api/Contract/search' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"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
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. | Optional | true |
linkedOrderId | integer | The linked order id. | Optional | true |
- Request
- Response
- cURL Request
{
"accountId": 1,
"contractId": "CON.F.US.DA6.M25",
"type": 2,
"side": 1,
"size": 1,
"limitPrice": null,
"stopPrice": null,
"trailPrice": null,
"customTag": null,
"linkedOrderId": null
}
{
"orderId": 9056,
"success": true,
"errorCode": 0,
"errorMessage": null
}
curl -X 'POST' \
'https://gateway-api-demo.s2f.projectx.com/api/Order/place' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"accountId": 1,
"contractId": "CON.F.US.DA6.M25",
"type": 2,
"side": 1,
"size": 1,
"limitPrice": null,
"stopPrice": null,
"trailPrice": null,
"customTag": null,
"linkedOrderId": null
}'