Skip to content

Calculate margin#

About#

Calculates margin required to open a trade on the specified trading account.

POST /users/current/accounts/:accountId/calculate-margin

For more information see Swagger documentation. Note, that this URL is valid for vint-hill 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

Body#

To execute the command, it is necessary to supply the request body in the format of the MarginOrder model.

Response#

Possible error response codes are listed here.

Responses:

  • 200 - Margin for the specified trading account returned successfully. Response schema: Margin
  • 400 - Payload is not valid. Response schema: Error
  • 401 - Authorization failed. Response schema: Error
  • 404 - Trading account not found or not provisioned yet. Response schema: Error
Examples#

Example request:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'auth-token: token' -d '{
  "symbol": "EURUSD",
  "type":"ORDER_TYPE_BUY",
  "volume": 0.1,
  "openPrice": 1.1
}' 'https://mt-client-api-v1.vint-hill.agiliumtrade.ai/users/current/accounts/865d3a4d-3803-486d-bdf3-a85679d9fad2/calculate-margin'

Example response:

{
  "margin": 110
}