Package markets.alpaca.client.rest
Class AlpacaFutures
java.lang.Object
markets.alpaca.client.rest.AlpacaFutures
Adapters from generated
*Async(..., ApiCallback<T>) REST methods to CompletableFuture.
Generated Broker, Market Data, and Trading clients each define their own ApiCallback
and ApiException types. These overloads keep those generated types intact while letting
application code use futures:
CompletableFuture<Account> future =
AlpacaFutures.trading(callback -> accountsApi.getAccountAsync(callback));
Cancelling the returned future cancels the underlying OkHttp Call.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CompletableFuture<T>broker(AlpacaFutures.BrokerAsyncCall<T> asyncCall) Completes with the deserialized Broker response body.static <T> CompletableFuture<AlpacaApiResponse<T>>brokerResponse(AlpacaFutures.BrokerAsyncCall<T> asyncCall) Completes with the Broker response body, HTTP status code, and headers.static <T> CompletableFuture<T>data(AlpacaFutures.DataAsyncCall<T> asyncCall) Completes with the deserialized Market Data response body.static <T> CompletableFuture<AlpacaApiResponse<T>>dataResponse(AlpacaFutures.DataAsyncCall<T> asyncCall) Completes with the Market Data response body, HTTP status code, and headers.static <T> CompletableFuture<T>trading(AlpacaFutures.TradingAsyncCall<T> asyncCall) Completes with the deserialized Trading response body.static <T> CompletableFuture<AlpacaApiResponse<T>>tradingResponse(AlpacaFutures.TradingAsyncCall<T> asyncCall) Completes with the Trading response body, HTTP status code, and headers.
-
Method Details
-
broker
Completes with the deserialized Broker response body. -
brokerResponse
public static <T> CompletableFuture<AlpacaApiResponse<T>> brokerResponse(AlpacaFutures.BrokerAsyncCall<T> asyncCall) Completes with the Broker response body, HTTP status code, and headers. -
data
Completes with the deserialized Market Data response body. -
dataResponse
public static <T> CompletableFuture<AlpacaApiResponse<T>> dataResponse(AlpacaFutures.DataAsyncCall<T> asyncCall) Completes with the Market Data response body, HTTP status code, and headers. -
trading
Completes with the deserialized Trading response body. -
tradingResponse
public static <T> CompletableFuture<AlpacaApiResponse<T>> tradingResponse(AlpacaFutures.TradingAsyncCall<T> asyncCall) Completes with the Trading response body, HTTP status code, and headers.
-