Package markets.alpaca.client
Class AlpacaClient.Builder
java.lang.Object
markets.alpaca.client.AlpacaClient.Builder
- Enclosing class:
- AlpacaClient
Builder for immutable
AlpacaClient instances.-
Method Summary
Modifier and TypeMethodDescriptionbrokerBaseUrl(String brokerBaseUrl) Overrides the Broker REST API base URL.brokerCredentials(AlpacaCredentials brokerCredentials) Overrides the credentials used by Broker REST and SSE workflows.brokerEnvironment(BrokerApiEnvironment brokerEnvironment) Sets the Broker API environment.brokerHttpClient(okhttp3.OkHttpClient brokerHttpClient) Sets the HTTP client used by Broker REST and SSE calls.brokerSseCallbackExecutor(Executor brokerSseCallbackExecutor) Sets the application-owned executor for Broker SSE callbacks.brokerSseOptions(AlpacaSseOptions brokerSseOptions) Sets transport options for Broker Events SSE subscriptions.build()Builds an immutable client facade using the configured credentials, environments, base URLs, HTTP clients, and SSE settings.dataBaseUrl(String dataBaseUrl) Overrides the Market Data REST API base URL.dataCredentials(AlpacaCredentials dataCredentials) Overrides the credentials used by Market Data REST workflows.dataHttpClient(okhttp3.OkHttpClient dataHttpClient) Sets the HTTP client used by Market Data REST and corporate-actions SSE calls.dataSseCallbackExecutor(Executor dataSseCallbackExecutor) Sets the application-owned executor for Market Data SSE callbacks.dataSseOptions(AlpacaSseOptions dataSseOptions) Sets transport options for Market Data corporate-actions SSE subscriptions.httpClient(okhttp3.OkHttpClient httpClient) Uses the same HTTP client for Trading, Market Data, and Broker workloads.marketDataSseEnvironment(MarketDataSseEnvironment marketDataSseEnvironment) Selects the Market Data corporate-actions stream environment.tradingBaseUrl(String tradingBaseUrl) Overrides the Trading REST API base URL.tradingCredentials(AlpacaCredentials tradingCredentials) Overrides the credentials used by Trading REST workflows.tradingEnvironment(TradingApiEnvironment tradingEnvironment) Sets the Trading API environment.tradingHttpClient(okhttp3.OkHttpClient tradingHttpClient) Sets the HTTP client used by Trading REST and SSE calls.tradingSseCallbackExecutor(Executor tradingSseCallbackExecutor) Sets the application-owned executor for Trading SSE callbacks.tradingSseOptions(AlpacaSseOptions tradingSseOptions) Sets transport options for Trading account-activity SSE subscriptions.
-
Method Details
-
tradingCredentials
Overrides the credentials used by Trading REST workflows. -
dataCredentials
Overrides the credentials used by Market Data REST workflows. -
brokerCredentials
Overrides the credentials used by Broker REST and SSE workflows. -
tradingEnvironment
Sets the Trading API environment. Defaults to paper trading. -
brokerEnvironment
Sets the Broker API environment. Defaults to sandbox. -
tradingBaseUrl
Overrides the Trading REST API base URL. Defaults to the selected Trading environment. -
dataBaseUrl
Overrides the Market Data REST API base URL. Defaults to the generated client default. -
brokerBaseUrl
Overrides the Broker REST API base URL. Defaults to the selected Broker environment. -
httpClient
Uses the same HTTP client for Trading, Market Data, and Broker workloads. -
tradingHttpClient
Sets the HTTP client used by Trading REST and SSE calls. -
dataHttpClient
Sets the HTTP client used by Market Data REST and corporate-actions SSE calls. -
brokerHttpClient
Sets the HTTP client used by Broker REST and SSE calls. -
tradingSseOptions
Sets transport options for Trading account-activity SSE subscriptions. -
tradingSseCallbackExecutor
Sets the application-owned executor for Trading SSE callbacks.The SDK never shuts down the supplied executor.
-
marketDataSseEnvironment
public AlpacaClient.Builder marketDataSseEnvironment(MarketDataSseEnvironment marketDataSseEnvironment) Selects the Market Data corporate-actions stream environment. -
dataSseOptions
Sets transport options for Market Data corporate-actions SSE subscriptions. -
dataSseCallbackExecutor
Sets the application-owned executor for Market Data SSE callbacks.The SDK never shuts down the supplied executor.
-
brokerSseOptions
Sets transport options for Broker Events SSE subscriptions. -
brokerSseCallbackExecutor
Sets the application-owned executor for Broker SSE callbacks.The SDK never shuts down the supplied executor.
-
build
Builds an immutable client facade using the configured credentials, environments, base URLs, HTTP clients, and SSE settings.The builder copies supplied
OkHttpClientinstances withnewBuilder()so later mutations by the caller cannot change this client.
-