alpaca-java 0.1.2-SNAPSHOT API

Alpaca Java Client

The Alpaca Java client provides generated REST clients and handwritten convenience layers for Alpaca Broker, Market Data, Trading, WebSocket, and Broker Events SSE APIs.

Start Here

Most applications should start with AlpacaClient or AlpacaClientFactory. AlpacaClient is the immutable facade for common workflows. AlpacaClientFactory creates preconfigured generated REST clients, stream clients, and SSE clients for lower-level use.

REST APIs

REST clients are generated at build time from the configured Alpaca OpenAPI specs. Each API has independent generated api, model, and http packages:

Use the generated clients directly when you need complete endpoint coverage. Use the handwritten packages when you want named request objects, immutable facades, pagination helpers, futures adapters, or stream lifecycle management.

Handwritten Packages

  • trading contains convenience facades for common Trading API workflows.
  • data contains convenience facades for common Market Data workflows.
  • rest contains pagination, response metadata, rate-limit, and CompletableFuture adapters for generated REST clients.
  • http contains shared OkHttp configuration, logging, and retry helpers.
  • broker.sse contains Broker Events Server-Sent Events clients.
  • ws contains handwritten WebSocket clients for stock data, crypto data, news, and trading updates.

Generated Sources

Generated REST sources live under build/generated and are not committed. This documentation is generated after generateApis, so it reflects whichever public or local OpenAPI specs were configured for the build.

Packages
Package
Description
Top-level entry points for the Alpaca Java client.
Handwritten Server-Sent Events clients for Alpaca Broker event streams.
Handwritten Market Data convenience facades.
OkHttp configuration and retry helpers used by Alpaca REST, WebSocket, and SSE clients.
Generated endpoint clients for the Broker API.
Generated HTTP transport support for the Broker API.
Generated authentication helpers for the Broker API.
Generated request and response models for the Broker API.
Generated endpoint clients for the Market Data API.
Generated HTTP transport support for the Market Data API.
Generated authentication helpers for the Market Data API.
Generated request and response models for the Market Data API.
Generated endpoint clients for the Trading API.
Generated HTTP transport support for the Trading API.
Generated authentication helpers for the Trading API.
Generated request and response models for the Trading API.
Utilities for working with generated Alpaca REST clients.
Handwritten Trading API convenience facades.
Handwritten WebSocket stream clients, listeners, subscriptions, and stream configuration.
Internal base classes for handwritten WebSocket stream clients.
Immutable payload models for Alpaca WebSocket stream events.