Class MetatraderAccountClient


  • public class MetatraderAccountClient
    extends MetaApiClient
    metaapi.cloud MetaTrader account API client (see https://metaapi.cloud/docs/provisioning/)
    • Constructor Detail

      • MetatraderAccountClient

        public MetatraderAccountClient​(HttpClient httpClient,
                                       String token)
        Constructs MetaTrader account API client instance with default domain agiliumtrade.agiliumtrade.ai
        Parameters:
        httpClient - HTTP client
        token - authorization token
    • Method Detail

      • getAccounts

        public CompletableFuture<List<MetatraderAccountDto>> getAccounts​(AccountsFilter accountsFilter)
        Retrieves MetaTrader accounts owned by user (see https://metaapi.cloud/docs/provisioning/api/account/readAccounts/). Method is accessible only with API access token.
        Parameters:
        accountsFilter - optional filter or null
        Returns:
        completable future resolving with MetaTrader accounts found
      • getAccountByToken

        public CompletableFuture<MetatraderAccountDto> getAccountByToken()
        Retrieves a MetaTrader account by token (see https://metaapi.cloud/docs/provisioning/api/account/readAccount/). Completes exceptionally if account is not found. Method is accessible only with account access token
        Returns:
        completable future resolving with MetaTrader account found
      • getAccount

        public CompletableFuture<MetatraderAccountDto> getAccount​(String id)
        Retrieves a MetaTrader account by id (see https://metaapi.cloud/docs/provisioning/api/account/readAccount/). Completable future is completed with an error if account is not found.
        Parameters:
        id - MetaTrader account id
        Returns:
        completable future resolving with MetaTrader account found
      • createAccount

        public CompletableFuture<MetatraderAccountIdDto> createAccount​(NewMetatraderAccountDto account)
        Starts cloud API server for a MetaTrader account using specified provisioning profile (see https://metaapi.cloud/docs/provisioning/api/account/createAccount/). It takes some time to launch the terminal and connect the terminal to the broker, you can use the connectionStatus field to monitor the current status of the terminal. Method is accessible only with API access token.
        Parameters:
        account - MetaTrader account to create
        Returns:
        completable future resolving with an id of the MetaTrader account created
      • deployAccount

        public CompletableFuture<Void> deployAccount​(String id)
        Starts API server for MetaTrader account. This request will be ignored if the account has already been deployed. (see https://metaapi.cloud/docs/provisioning/api/account/deployAccount/)
        Parameters:
        id - MetaTrader account id to deploy
        Returns:
        completable future resolving when MetaTrader account is scheduled for deployment
      • undeployAccount

        public CompletableFuture<Void> undeployAccount​(String id)
        Stops API server for a MetaTrader account. Terminal data such as downloaded market history data will be preserved. (see https://metaapi.cloud/docs/provisioning/api/account/undeployAccount/)
        Parameters:
        id - MetaTrader account id to undeploy
        Returns:
        completable future resolving when MetaTrader account is scheduled for undeployment
      • redeployAccount

        public CompletableFuture<Void> redeployAccount​(String id)
        Redeploys MetaTrader account. This is equivalent to undeploy immediately followed by deploy. (see https://metaapi.cloud/docs/provisioning/api/account/deployAccount/)
        Parameters:
        id - MetaTrader account id to redeploy
        Returns:
        completable future resolving when MetaTrader account is scheduled for redeployment
      • deleteAccount

        public CompletableFuture<Void> deleteAccount​(String id)
        Stops and deletes an API server for a specified MetaTrader account. The terminal state such as downloaded market data history will be deleted as well when you delete the account (see https://metaapi.cloud/docs/provisioning/api/account/deleteAccount/). Method is accessible only with API access token
        Parameters:
        id - MetaTrader account id
        Returns:
        completable future resolving when MetaTrader account is scheduled for deletion
      • updateAccount

        public CompletableFuture<Void> updateAccount​(String id,
                                                     MetatraderAccountUpdateDto account)
        Updates existing metatrader account data (see https://metaapi.cloud/docs/provisioning/api/account/updateAccount/). Method is accessible only with API access token
        Parameters:
        id - MetaTrader account id
        account - updated MetaTrader account
        Returns:
        completable future resolving when MetaTrader account is updated