Skip to content

Read open trades#

About#

Returns open trades for MetaApi account. This API call is not billable

GET /users/current/accounts/:accountId/open-trades

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 MetaApi account token. See Authentication & authorization

Path parameters#

Name Type Required Description
accountId string Yes MetaApi account id

Response#

Responses:

  • 200 - Open trades for a specified MetaTrader account returned successfully. Response schema: {trades: Array}
  • 401 - Authorization failed due to auth-token invalid. Response schema: Error
  • 403 - MetaStats API is not enabled on provided trading account. Response schema: Error
  • 404 - MetaTrader account not found or not provisioned yet. Response schema: Error

Examples#

Example request:

curl -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'auth-token: token' 'https://metastats-api-v1.new-york.agiliumtrade.ai/users/current/accounts/865d3a4d-3803-486d-bdf3-a85679d9fad2/open-trades'

Example synchronous response: ```json { "openTrades": [ { "_id": "865d3a4d-3803-486d-bdf3-a85679d9fad2c+1040", "accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2", "positionId": "1040", "volume": 1, "profit": 0.12, "success": "won", "openTime": "2021-10-15 20:34:54.000", "type": "POSITION_TYPE_BUY", "symbol": "EURUSD", "openPrice": 1.1835, "durationInMinutes": 1215, "gain": 0.04003202562049639, "pips": 11 } ] }