Class AlpacaClient

java.lang.Object
markets.alpaca.client.AlpacaClient

public final class AlpacaClient extends Object
Immutable top-level facade for common Alpaca workflows.

The generated REST ApiClient classes are mutable. This client owns configured generated clients internally and exposes narrower workflow facades for common calls. When an unsupported generated endpoint is needed, call one of the new*Client() methods to get a fresh mutable generated client that can be customized without mutating this client.

  • Method Details

    • builder

      public static AlpacaClient.Builder builder(AlpacaCredentials credentials)
      Creates a client builder.

      The supplied credentials are used for Trading, Market Data, and Broker APIs unless overridden with AlpacaClient.Builder.tradingCredentials(AlpacaCredentials), AlpacaClient.Builder.dataCredentials(AlpacaCredentials), or AlpacaClient.Builder.brokerCredentials(AlpacaCredentials).

    • orders

      public AlpacaClient.Orders orders()
      Returns common Trading order workflows without exposing the mutable generated client.
    • stocks

      public AlpacaClient.Stocks stocks()
      Returns common Market Data stock workflows without exposing the mutable generated client.
    • brokerEventsSseClient

      public BrokerEventsSseClient brokerEventsSseClient()
      Returns the Broker Events SSE client configured for this client.
    • newTradingClient

      public ApiClient newTradingClient()
      Returns a fresh mutable generated Trading client for endpoints not covered by this facade.

      Mutating the returned client does not affect this client or future calls to this method.

    • newDataClient

      public ApiClient newDataClient()
      Returns a fresh mutable generated Market Data client for endpoints not covered by this facade.

      Mutating the returned client does not affect this client or future calls to this method.

    • newBrokerClient

      public ApiClient newBrokerClient()
      Returns a fresh mutable generated Broker client for endpoints not covered by this facade.

      Mutating the returned client does not affect this client or future calls to this method.