Skip to content

Read position by id#

About#

Returns specific position for a MetaTrader account

GET /users/current/accounts/:accountId/positions/:positionId

For more information see Swagger documentation. Note, that this URL is valid for new-york region only. You can find URLs for other regions on API access page.

Headers#

Name Type Required Description
auth-token string Yes authorization token. See Authentication & authorization

Path parameters#

Name Type Required Description
accountId string Yes MetaTrader account id. You can retrieve account id from Web application after you add your MetaTrader account to our platform. The account id can also be obtained via Provisioning API
positionId string Yes position id (ticket number)

Query parameters#

Name Type Required Description
refreshTerminalState boolean whether to refresh terminal state before retrieving the data, slowing down the request. Defaults to false

Responses:

  • 200 - Position for a specified MetaTrader account returned successfully. Response schema: MetatraderPosition
  • 401 - Authorization failed. Response schema: Error
  • 404 - MetaTrader account not found or not provisioned yet or requested position does not exist. Response schema: Error

Examples#

Example request:

curl -X GET --header 'Accept: application/json' --header 'auth-token: token' 'https://mt-client-api-v1.new-york.agiliumtrade.ai/users/current/accounts/865d3a4d-3803-486d-bdf3-a85679d9fad2/positions/46648037'

Example response:

{
  "id": "46648037",
  "type": "POSITION_TYPE_BUY",
  "symbol": "AUDNZD",
  "magic": 1000,
  "time": "2020-04-17T04:30:03.223Z",
  "brokerTime": "2020-04-17 07:30:03.223",
  "openPrice": 1.05782,
  "currentPrice": 1.05299,
  "currentTickValue": 0.59971,
  "stopLoss": 0.99877,
  "volume": 0.1,
  "swap": -0.5,
  "profit": -28.96846699999893,
  "updateTime": "2020-04-20T08:54:42.119Z",
  "commission": -0.5,
  "clientId": "AS_AUDNZD_46648037",
  "unrealizedProfit": -28.96599299999934,
  "realizedProfit": -0.002473999999590859
}