Class TradingClient


  • public class TradingClient
    extends MetaApiClient
    metaapi.cloud CopyFactory trading API (trade copying trading API) client (see https://trading-api-v1.project-stock.agiliumlabs.cloud/swagger/#/)
    • Constructor Detail

      • TradingClient

        public TradingClient​(HttpClient httpClient,
                             String token)
        Constructs CopyFactory trading API client instance. Domain is set to agiliumtrade.agiliumtrade.ai
        Parameters:
        httpClient - HTTP client
        token - authorization token
      • TradingClient

        public TradingClient​(HttpClient httpClient,
                             String token,
                             String domain)
        Constructs CopyFactory trading API client instance
        Parameters:
        httpClient - HTTP client
        token - authorization token
        domain - domain to connect to
    • Method Detail

      • resynchronize

        public CompletableFuture<Void> resynchronize​(String accountId,
                                                     List<String> strategyIds)
        Resynchronizes the account. See https://trading-api-v1.agiliumtrade.agiliumtrade.ai/swagger/#!/default/post_users_current_accounts_accountId_resynchronize
        Parameters:
        accountId - account id
        strategyIds - optional array of strategy ids to recynchronize, or null. Default is to synchronize all strategies
        Returns:
        completable future which resolves when resynchronization is scheduled
      • getStopouts

        public CompletableFuture<List<CopyFactoryStrategyStopout>> getStopouts​(String accountId)
        Returns subscriber account stopouts. See https://trading-api-v1.agiliumtrade.agiliumtrade.ai/swagger/#!/default/get_users_current_accounts_accountId_stopouts
        Parameters:
        accountId - account id
        Returns:
        completable future which resolves with stopouts found
      • resetStopout

        public CompletableFuture<Void> resetStopout​(String accountId,
                                                    String reason)
        Resets account stopout. See https://trading-api-v1.agiliumtrade.agiliumtrade.ai/swagger/#!/default/post_users_current_accounts_accountId_stopouts_reason_reset
        Parameters:
        accountId - account id
        reason - stopout reason to reset. One of yearly-balance, monthly-balance, daily-balance, yearly-equity, monthly-equity, daily-equity, max-drawdown
        Returns:
        completable future which resolves when the stopout is reset