Class EventsApi
java.lang.Object
markets.alpaca.client.openapi.trading.api.EventsApi
Generated client for EventsApi operations.
This class is generated from the configured OpenAPI spec. Operation method Javadocs include OAS summaries, descriptions, parameters, return types, response details, and external documentation links when present in the spec.
Operations
subscribeToActivitiesSSE: Subscribe to Activity Events (SSE)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidsetApiClient(ApiClient apiClient) voidsetCustomBaseUrl(String customBaseUrl) voidsetHostIndex(int hostIndex) subscribeToActivitiesSSE(OffsetDateTime since, OffsetDateTime until, String sinceId, String untilId) Subscribe to Activity Events (SSE) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events).okhttp3.CallsubscribeToActivitiesSSEAsync(OffsetDateTime since, OffsetDateTime until, String sinceId, String untilId, ApiCallback<List<ActivityEventV2>> _callback) Subscribe to Activity Events (SSE) (asynchronously) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events).okhttp3.CallsubscribeToActivitiesSSECall(OffsetDateTime since, OffsetDateTime until, String sinceId, String untilId, ApiCallback _callback) Build call for subscribeToActivitiesSSEsubscribeToActivitiesSSEWithHttpInfo(OffsetDateTime since, OffsetDateTime until, String sinceId, String untilId) Subscribe to Activity Events (SSE) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events).
-
Constructor Details
-
EventsApi
public EventsApi() -
EventsApi
-
-
Method Details
-
getApiClient
-
setApiClient
-
getHostIndex
public int getHostIndex() -
setHostIndex
public void setHostIndex(int hostIndex) -
getCustomBaseUrl
-
setCustomBaseUrl
-
subscribeToActivitiesSSECall
public okhttp3.Call subscribeToActivitiesSSECall(@Nullable OffsetDateTime since, @Nullable OffsetDateTime until, @Nullable String sinceId, @Nullable String untilId, ApiCallback _callback) throws ApiException Build call for subscribeToActivitiesSSE- Parameters:
since- Format: RFC3339 or YYYY-MM-DD (optional)until- Format: RFC3339 or YYYY-MM-DD (optional)sinceId- (optional)untilId- (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Connected. Events will now start streaming as long as you keep the connection open. -
-
subscribeToActivitiesSSE
public List<ActivityEventV2> subscribeToActivitiesSSE(@Nullable OffsetDateTime since, @Nullable OffsetDateTime until, @Nullable String sinceId, @Nullable String untilId) throws ApiException Subscribe to Activity Events (SSE) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events). This endpoint streams events on account activities. Historical events are streamed immediately if queried, and updates are pushed as events occur. Query parameter rules: - If `until` is specified, `since` is required. - If `until_id` is specified, `since_id` is required. - You cannot use `since` and `since_id` together. Behavior: - If `since` or `since_id` is not specified, this will not return any historic data. - If `until` or `until_id` is specified, stream will end at the specified point with status 200. --- Warning: Currently, OAS-3 does not fully support responses from an SSE API. In case the client code is generated from this OAS spec, please do not specify `since` and `until`, as the generated client may hang forever waiting for the response to end. If you require the streaming capabilities, we recommend not using the generated clients for this specific endpoint until the OAS-3 standards define how to represent this behavior. --- ### Comment messages According to the SSE specification, any line that starts with a colon is a comment which does not contain data. It is typically a free text that does not follow any data schema. A few examples mentioned below for comment messages. ##### Slow client The server sends a comment when the client is not consuming messages fast enough. Example: `: you are reading too slowly, dropped 10000 messages` ##### Internal server error An error message is sent as a comment when the server closes the connection on an internal server error (only sent by the v2 and v2beta1 endpoints). Example: `: internal server error` ---- Parameters:
since- Format: RFC3339 or YYYY-MM-DD (optional)until- Format: RFC3339 or YYYY-MM-DD (optional)sinceId- (optional)untilId- (optional)- Returns:
- List<ActivityEventV2>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Connected. Events will now start streaming as long as you keep the connection open. -
-
subscribeToActivitiesSSEWithHttpInfo
public ApiResponse<List<ActivityEventV2>> subscribeToActivitiesSSEWithHttpInfo(@Nullable OffsetDateTime since, @Nullable OffsetDateTime until, @Nullable String sinceId, @Nullable String untilId) throws ApiException Subscribe to Activity Events (SSE) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events). This endpoint streams events on account activities. Historical events are streamed immediately if queried, and updates are pushed as events occur. Query parameter rules: - If `until` is specified, `since` is required. - If `until_id` is specified, `since_id` is required. - You cannot use `since` and `since_id` together. Behavior: - If `since` or `since_id` is not specified, this will not return any historic data. - If `until` or `until_id` is specified, stream will end at the specified point with status 200. --- Warning: Currently, OAS-3 does not fully support responses from an SSE API. In case the client code is generated from this OAS spec, please do not specify `since` and `until`, as the generated client may hang forever waiting for the response to end. If you require the streaming capabilities, we recommend not using the generated clients for this specific endpoint until the OAS-3 standards define how to represent this behavior. --- ### Comment messages According to the SSE specification, any line that starts with a colon is a comment which does not contain data. It is typically a free text that does not follow any data schema. A few examples mentioned below for comment messages. ##### Slow client The server sends a comment when the client is not consuming messages fast enough. Example: `: you are reading too slowly, dropped 10000 messages` ##### Internal server error An error message is sent as a comment when the server closes the connection on an internal server error (only sent by the v2 and v2beta1 endpoints). Example: `: internal server error` ---- Parameters:
since- Format: RFC3339 or YYYY-MM-DD (optional)until- Format: RFC3339 or YYYY-MM-DD (optional)sinceId- (optional)untilId- (optional)- Returns:
- ApiResponse<List<ActivityEventV2>>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Connected. Events will now start streaming as long as you keep the connection open. -
-
subscribeToActivitiesSSEAsync
public okhttp3.Call subscribeToActivitiesSSEAsync(@Nullable OffsetDateTime since, @Nullable OffsetDateTime until, @Nullable String sinceId, @Nullable String untilId, ApiCallback<List<ActivityEventV2>> _callback) throws ApiException Subscribe to Activity Events (SSE) (asynchronously) The Events API sends the real-time events and provides historical queries with SSE (Server Sent Events). This endpoint streams events on account activities. Historical events are streamed immediately if queried, and updates are pushed as events occur. Query parameter rules: - If `until` is specified, `since` is required. - If `until_id` is specified, `since_id` is required. - You cannot use `since` and `since_id` together. Behavior: - If `since` or `since_id` is not specified, this will not return any historic data. - If `until` or `until_id` is specified, stream will end at the specified point with status 200. --- Warning: Currently, OAS-3 does not fully support responses from an SSE API. In case the client code is generated from this OAS spec, please do not specify `since` and `until`, as the generated client may hang forever waiting for the response to end. If you require the streaming capabilities, we recommend not using the generated clients for this specific endpoint until the OAS-3 standards define how to represent this behavior. --- ### Comment messages According to the SSE specification, any line that starts with a colon is a comment which does not contain data. It is typically a free text that does not follow any data schema. A few examples mentioned below for comment messages. ##### Slow client The server sends a comment when the client is not consuming messages fast enough. Example: `: you are reading too slowly, dropped 10000 messages` ##### Internal server error An error message is sent as a comment when the server closes the connection on an internal server error (only sent by the v2 and v2beta1 endpoints). Example: `: internal server error` ---- Parameters:
since- Format: RFC3339 or YYYY-MM-DD (optional)until- Format: RFC3339 or YYYY-MM-DD (optional)sinceId- (optional)untilId- (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Connected. Events will now start streaming as long as you keep the connection open. -
-