Allocate Trading Account
Once you have successfully created a user, you must create a trading account so they may access and interact with the platform.
All trading accounts are created from a pre-existing Account Templates.
You may override specific template values such as starting balance, profit target, maximum position, etc. As of this writing, Account Templates are configured during your initial account setup and configuration. In the near future, we will be adding a graphical interface to your Admin panel as well as API functionality to add / edit / modify these templates. In the meantime, to add or modify Account Templates, please contact your account manager.
Account Template
Retrieve Existing Account Templates
API URL: GET https://userapi-demo.s2f.projectx.com/AccountTemplate
API Reference: /AccountTemplate
Before creating a user, you must select the Account Template to be used.
To retrieve a list of all available Account Templates, create a GET request to the trading account template endpoint referenced above.
Example Usage
- cURL
- Response
curl -X 'GET' \
'https://userapi-demo.s2f.projectx.com/AccountTemplate' \
-H 'accept: text/plain'
[
{
"id": 0,
"title": "string",
"titleColor": "string",
"description": "string",
"startingBalance": 0,
"margin": 0,
"name": "string",
"notes": "string",
"isActive": true,
"tag": 0
}
]
Create Your First SIM Account
API Reference: /TradingAccount/createSimAccount
To create a trading account, you will need a a user ID (created here), a template ID (created here), an account name, and an internal tag.
Internal Tag
- Default (0)
- This account belongs to a trader.
- Internal (1)
- This account belongs to an internal team member. Examples of internal team members include the development team, risk management team and support teams.
Example Usage
- Request
- cURL
- Response
This request will create a new trading account for a user with an ID 7, a template ID of 2, an account name of "EVALAPR1424", and an account type of "SIM."
{
"userId": 0,
"templateId": 0,
"accountName": "string",
"internalTag": 0
}
This request will create a new trading account for a user with an ID 7, a template ID of 2, an account name of "EVALAPR1424", and an account type of "SIM."
curl -X 'POST' \
'https://userapi-demo.s2f.projectx.com/TradingAccount/createSimAccount' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '{
"userId": 0,
"templateId": 0,
"accountName": "string",
"internalTag": 0
}'
{
"success": true,
"errorCode": 0,
"errorMessage": "string",
"tradingAccount": {
"accountName": "string",
"userId": 0,
"startingBalance": 0,
"balance": 0,
"status": 0,
"marketDataLevel": 0,
"accountId": 0,
"winRate": 0,
"profitAndLoss": 0,
"startDate": "2024-07-02T20:54:35.607Z",
"closedDate": "2024-07-02T20:54:35.607Z",
"dailyLoss": 0,
"maximumLoss": 0,
"drawDownLimit": 0,
"maxPositions": 0,
"type": 0,
"startOfDayBalance": 0,
"combineName": "string",
"platformId": 0,
"platformAccountId": "string",
"platformUserName": "string",
"maxMargin": 0,
"isSharing": true,
"realizedDayPnl": 0,
"updatedAt": "2024-07-02T20:54:35.607Z",
"personalDailyLossLimit": 0,
"personalDailyLossLimitAction": 0,
"personalDailyProfitTarget": 0,
"personalDailyProfitTargetAction": 0,
"totalProfit": 0,
"totalLoss": 0,
"totalTrades": 0,
"dailyTrades": 0,
"isFollower": true,
"isLeader": true,
"openPnl": 0,
"templateId": 0
}
}
Notes
Store the account ID and name within your platform and associate it with the user it was created for. Further Trading Account API requests will utilize either this ID or the account name in certain cases.