Admin API

1. API Description

  • Implementation – HTTP, REST, JSON
  • All endpoints should have an Authorization header. The authorization API Key will be provided separately.
  • The “unit” parameter is the equivalent of a trading group id. All unit IDs will be provided separately
  • UAT env. base-url: https://portalappqa.thinkmarkets.com
  • Production env. base-url: https://portalapp.thinkmarkets.com

2. API test parameters

  • Authorization header: To be provided separately
  • group: “49295660:ThinkTrader_Proptec
  • unit: 49295660

3. Change list

  • Added new endpoing – GetAccountClosedPositions, which returns all closed positions for a given account number in a specified period of time.
  • Added new endpoint – GetAccountStats, which returns the current account stats for a specified account number.

3. Endpoints

  3.1 CreateTradingAccount

POST https://base-url/cportal/prop/demo/accounts/create

Description: Creates a new ThinkTrader demo trading account entirely through the API with a single request.

Note: Password must have the following conditions:
– Length: 8 to 30 characters
– Must include one of: Uppercase Letter, Lowercase Letter, Number and Special(!#$%…)

REQUEST
RESPONSE

{ 
  "email": string, 
  "firstName": string,
  "lastName": string,
  "group": string,
  "unit":  integer,  
  "enabled": bool, 
  "currency": "USD",
  "platform ": "ThinkTrader"
  "country": "ER",
  "password" : "Password!"
} 

{ 
  "status": "success", 
  "accountNumber": integer
}

  3.2 Deposit

POST https://base-url/cportal/prop/demo/accounts/deposit

Description: Deposits funds to a trading account.

REQUEST
RESPONSE

{ 
  "accountNumber": integer, 
  "unit":  integer,  
  "amount": double, 
  "comment": string
}

{ 
  "status": "success", 
  "accountBalance": double
}

  3.3 Withdrawal

POST https://base-url/cportal/prop/demo/accounts/withdraw

Description: Withdraws funds from a trading account.

REQUEST
RESPONSE

{ 
  "accountNumber": integer, 
  "unit":  integer,  
  "amount": double, 
  "comment": string
}

{ 
  "status": "success", 
  "accountBalance": double
}

  3.4 ChangeAccountEnablement

POST https://base-url/cportal/prop/demo/accounts/enable

Description: Enables or disables an array of trading accounts, based on the value of the “enable” parameter.

REQUEST
RESPONSE

{ 
  "enable": bool,
  "unit":  integer,
  "accountNumbers":
  [ 
    integer, 
    integer
  ]
}

{ 
  "status": "success", 
  "message": "[\"Bulk update of trading accounts finished.\\n\"]" 
} 

  3.5 ClosePositions

POST https://base-url/cportal/prop/demo/accounts/close-all-positions

Description: Closes all positions of a specified trading account.

REQUEST
RESPONSE

{ 
  "accountNumber": integer, 
  "unit":  integer
}

{ 
  "status": "success", 
  "message": "[]" 
}

  3.6 ClosePositionById

POST https://base-url/cportal/prop/demo/accounts/close-position

Description: Closes a specific position of a given trading account.

REQUEST
RESPONSE

{ 
  "accountNumber": integer, 
  "unit":  integer,
  "orderrequestid":  integer
}

{ 
  "status": "success", 
  "message": "[]" 
}

  3.7 GetClosedPositions

POST https://base-url/cportal/prop/demo/accounts/closed-positions

Description: Provides the list of closed positions for a specified time period.

REQUEST
RESPONSE

{
  "unit":  integer,
  "from": date, //"2024-02-10T09:39:47"
  "to":   date //"2024-02-15T09:44:47" 
}

{ 
  "status": "success", 
  "message": "
  [[
  {
    "accountId":integer,
    "tradeId": integer,
    "symbol":string,
    "lots":double,
    "quantity":double,
    "usdQuantity": double,
    "direction":"buy",
    "openTimeUTC": date, //"2024-02-10 09:20:47"
    "openPrice": double,
    "closeTimeUTC": date, //"2024-02-12 09:20:47"
    "closePrice": double,
    "profitLoss": double
  },
  {
    "accountId": integer,
    "tradeId": integer,
    "symbol": string,
    "lots": double,
    "quantity": double,
    "usdQuantity": double,
    "direction":"sell",
    "openTimeUTC": date, //"2024-02-10 09:20:47"
    "openPrice": double,
    "closeTimeUTC": date, //"2024-02-10 09:30:47"
    "closePrice": double,
    "profitLoss": double
  },
]]
}

  3.8 GetClosedPositionsByAccount

POST https://base-url/cportal/prop/demo/accounts/account-closed-positions

Description: Provides the list of closed positions for a specified time period.

REQUEST
RESPONSE

{
  "unit":  integer,
  "accountNumber":  integer,    
  "from": date, //"2024-02-10T09:39:47"
  "to":   date //"2024-02-15T09:44:47" 
}

{ 
  "status": "success", 
  "message": "
  [
  {
    "accountId":integer,
    "tradeId": integer,
    "symbol":string,
    "lots":double,
    "quantity":double,
    "usdQuantity": double,
    "direction":"buy",
    "openTimeUTC": date, //"2024-02-10 09:20:47"
    "openPrice": double,
    "closeTimeUTC": date, //"2024-02-10 09:30:47"
    "closePrice": double,
    "profitLoss": double
  },
  {
    "accountId": integer,
    "tradeId": integer,
    "symbol": string,
    "lots": double,
    "quantity": double,
    "usdQuantity": double,
    "direction":"sell",
    "openTimeUTC": date, //"2024-02-10 09:30:47"
    "openPrice": double,
    "closeTimeUTC": date, //"2024-02-10 09:39:47"
    "closePrice": double,
    "profitLoss": double
  },
]
}

  3.9 GetAllTradingAccountsDetails

POST https://base-url/cportal/prop/demo/accounts/accounts-details

Description: Provides account details for all trading accounts belonging to a given prop firm.

REQUEST
RESPONSE

{
  "unit":  integer
}

{ 
  [
    {
      "accountNumber": integer,
      "firstName": string,
      "lastName": string,
      "email": string,
      "group": string,
      "enabled": bool,
      "createdDate": date, //"2024-02-10T09:39:47"
      "leverage": integer,
      "balance": double
    },
    {
      "accountNumber": integer,
      "firstName": string,
      "lastName": string,
      "email": string,
      "group": string,
      "enabled": bool,
      "createdDate": date, //"2024-02-10T09:39:47"
      "leverage": integer,
      "balance": double
    }
  ]
}       

  3.10 GetAccountDetails

POST https://base-url/cportal/prop/demo/accounts/account-details

Description: Provides account details for a provided trading account number.

REQUEST
RESPONSE

{
  "accountNumber":  integer
}

{
  "accountNumber": integer,
  "firstName": string,
  "lastName": string,
  "email": string,
  "group": string,
  "enabled": bool,
  "createdDate": date, //"2024-02-10T09:39:47"
  "leverage": integer,
  "balance": double
}    

  3.11 GetAllTradingAccountsStats

POST https://base-url/cportal/prop/demo/accounts/accounts-stats

Description: Provides account stat details for all trading accounts belonging to a given unit.

REQUEST
RESPONSE

{
  "unit": integer
}

{ 
  [
    {
      "accountNumber": integer,
      "balance": double,
      "equity": double,
      "margin": double,
      "freeMargin": double,
      "pnl": double
    },
    {
      "accountNumber": integer,
      "balance": double,
      "equity": double,
      "margin": double,
      "freeMargin": double,
      "pnl": double
    },
  ]
} 

  3.12 GetTradingAccountStats

POST https://base-url/cportal/prop/demo/accounts/account-stats

Description: Provides account stat details for a specific trading account.

REQUEST
RESPONSE

{
  "unit": integer,
  "accountNumber": integer
}

{ 
  "accountNumber": integer,
  "balance": double,
  "equity": double,
  "margin": double,
  "freeMargin": double,
  "pnl": double
}

  3.13 Ping

GET https://base-url/cportal/prop/ping

Description: Healthcheck API endpoint. Returns 200 if the service is up and running.

REQUEST
RESPONSE

{}

{
  "status": 200
}

  3.14 Opened Positions:

POSТ https://portalappqa.thinkmarkets.com/cportal/prop/demo/accounts/opened-positions

REQUEST
RESPONSE

{
    "unit": 49490520
}

{
    "status": "success",
    "result": "[{"accountId":49513940,"positionId":100776741,"symbol":"BTCUSD","lots":0.01,"quantity":-0.01,"usdQuantity":-616.043,"direction":"Sell","openTime":1716190353400,"openPrice":66779.79,"realTimePL":51.48889999999992},{"accountId":49513940,"positionId":100776742,"symbol":"XAUUSD","lots":0.03,"quantity":3.0,"usdQuantity":6887.280000000001,"direction":"Buy","openTime":1716190356759,"openPrice":2439.05,"realTimePL":-430.4700000000007},
.....
    ]"
}

  3.15 Account Transfers:

POSТ https://base-url/cportal/prop/demo/accounts/account-transfers

Header: ApiKey

REQUEST
RESPONSE

{
    "accountNumber": 49519820,
    "unit": 49490520
}

{
    "status": "success",
    "result": "[{\"amount\":\"50.00000000\",\"createdDate\":\"2024-06-18 14:30:16.273\",\"type\":\"DEPOSIT\"},{\"amount\":\"50.00000000\",\"createdDate\":\"2024-06-18 14:30:28.41\",\"type\":\"DEPOSIT\"}]"
}

  3.16 Get all Units:

POSТ https://portalappqa.thinkmarkets.com/cportal/prop/demo/units/get-all

REQUEST
RESPONSE

{}

{
    "49490520": "TEST_USD_FTP"
}

  3.17 Password Reset:

POSТ https://baseUrl/cportal/prop/demo/accounts/reset-password

REQUEST
RESPONSE

{
    "accountNumber": 49530200,
    "unit" : 49490520,
    "password" : "Password1!"
}

{}