Class TradingEventsSseClient
java.lang.Object
markets.alpaca.client.trading.sse.TradingEventsSseClient
Streaming client for Trading account-activity Server-Sent Events.
-
Constructor Summary
ConstructorsConstructorDescriptionTradingEventsSseClient(ApiClient apiClient) TradingEventsSseClient(ApiClient apiClient, Executor callbackExecutor) Creates a Trading SSE client with resilient defaults and a callback executor.TradingEventsSseClient(ApiClient apiClient, AlpacaSseOptions options) Creates a Trading SSE client with explicit transport options and direct callbacks.TradingEventsSseClient(ApiClient apiClient, AlpacaSseOptions options, Executor callbackExecutor) -
Method Summary
Modifier and TypeMethodDescriptionOpens a live activity stream without requesting historical events.subscribeToActivities(TradingActivitySseRequest request, AlpacaSseListener<ActivityEventV2> listener) Opens an activity stream with the supplied history/boundary cursors.
-
Constructor Details
-
TradingEventsSseClient
-
TradingEventsSseClient
Creates a Trading SSE client with explicit transport options and direct callbacks. -
TradingEventsSseClient
Creates a Trading SSE client with resilient defaults and a callback executor. -
TradingEventsSseClient
public TradingEventsSseClient(ApiClient apiClient, AlpacaSseOptions options, Executor callbackExecutor)
-
-
Method Details
-
subscribeToActivities
public AlpacaSseSubscription subscribeToActivities(AlpacaSseListener<ActivityEventV2> listener) throws ApiException Opens a live activity stream without requesting historical events.- Throws:
ApiException
-
subscribeToActivities
public AlpacaSseSubscription subscribeToActivities(TradingActivitySseRequest request, AlpacaSseListener<ActivityEventV2> listener) throws ApiException Opens an activity stream with the supplied history/boundary cursors.An initial event ID in the client options cannot be combined with a date-bounded request. For an ID-bounded request, that initial ID must not be after the request's upper bound.
A malformed event is reported through
AlpacaSseListener.onEventFailure(AlpacaSseDeserializationException), skipped, and committed as the resume cursor; the healthy stream continues with the next event.- Throws:
ApiException
-