Class LocatesApi

java.lang.Object
markets.alpaca.client.openapi.trading.api.LocatesApi

public class LocatesApi extends Object
Generated client for LocatesApi 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

  • createLocates: Create Locate
  • getLocate: Get Locate
  • listLocateQuotes: Get Locate Quotes
  • listLocates: List Locates
  • Constructor Details

    • LocatesApi

      public LocatesApi()
    • LocatesApi

      public LocatesApi(ApiClient apiClient)
  • Method Details

    • getApiClient

      public ApiClient getApiClient()
    • setApiClient

      public void setApiClient(ApiClient apiClient)
    • getHostIndex

      public int getHostIndex()
    • setHostIndex

      public void setHostIndex(int hostIndex)
    • getCustomBaseUrl

      public String getCustomBaseUrl()
    • setCustomBaseUrl

      public void setCustomBaseUrl(String customBaseUrl)
    • createLocatesCall

      public okhttp3.Call createLocatesCall(@Nonnull CreateLocateRequest createLocateRequest, @Nullable String idempotencyKey, ApiCallback _callback) throws ApiException
      Build call for createLocates
      Parameters:
      createLocateRequest - Locate request details. (required)
      idempotencyKey - Optional client-generated key for safe retries and duplicate request detection. This endpoint currently accepts keys up to 128 characters. Alpaca is moving toward a 36-character maximum; new implementations should generate a unique UUIDv7 or UUIDv4 value (36 characters including hyphens) for each logical operation. Do not reuse a key across operations. (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
      201 Created -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      422 Cannot complete locate request. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • createLocates

      public Locate createLocates(@Nonnull CreateLocateRequest createLocateRequest, @Nullable String idempotencyKey) throws ApiException
      Create Locate Creates a locate request for a short sale. This endpoint is not available in paper trading. **Idempotency**: Reusing the same key with the same request returns the original locate response. Reusing the same key with a different request returns HTTP 422.
      Parameters:
      createLocateRequest - Locate request details. (required)
      idempotencyKey - Optional client-generated key for safe retries and duplicate request detection. This endpoint currently accepts keys up to 128 characters. Alpaca is moving toward a 36-character maximum; new implementations should generate a unique UUIDv7 or UUIDv4 value (36 characters including hyphens) for each logical operation. Do not reuse a key across operations. (optional)
      Returns:
      Locate
      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
      201 Created -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      422 Cannot complete locate request. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • createLocatesWithHttpInfo

      public ApiResponse<Locate> createLocatesWithHttpInfo(@Nonnull CreateLocateRequest createLocateRequest, @Nullable String idempotencyKey) throws ApiException
      Create Locate Creates a locate request for a short sale. This endpoint is not available in paper trading. **Idempotency**: Reusing the same key with the same request returns the original locate response. Reusing the same key with a different request returns HTTP 422.
      Parameters:
      createLocateRequest - Locate request details. (required)
      idempotencyKey - Optional client-generated key for safe retries and duplicate request detection. This endpoint currently accepts keys up to 128 characters. Alpaca is moving toward a 36-character maximum; new implementations should generate a unique UUIDv7 or UUIDv4 value (36 characters including hyphens) for each logical operation. Do not reuse a key across operations. (optional)
      Returns:
      ApiResponse<Locate>
      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
      201 Created -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      422 Cannot complete locate request. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • createLocatesAsync

      public okhttp3.Call createLocatesAsync(@Nonnull CreateLocateRequest createLocateRequest, @Nullable String idempotencyKey, ApiCallback<Locate> _callback) throws ApiException
      Create Locate (asynchronously) Creates a locate request for a short sale. This endpoint is not available in paper trading. **Idempotency**: Reusing the same key with the same request returns the original locate response. Reusing the same key with a different request returns HTTP 422.
      Parameters:
      createLocateRequest - Locate request details. (required)
      idempotencyKey - Optional client-generated key for safe retries and duplicate request detection. This endpoint currently accepts keys up to 128 characters. Alpaca is moving toward a 36-character maximum; new implementations should generate a unique UUIDv7 or UUIDv4 value (36 characters including hyphens) for each logical operation. Do not reuse a key across operations. (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
      201 Created -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      422 Cannot complete locate request. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • getLocateCall

      public okhttp3.Call getLocateCall(@Nonnull UUID locateId, ApiCallback _callback) throws ApiException
      Build call for getLocate
      Parameters:
      locateId - The locate ID. (required)
      _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 Returns the requested locate. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      404 Not found -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • getLocate

      public Locate getLocate(@Nonnull UUID locateId) throws ApiException
      Get Locate Returns a locate by ID. This endpoint is not available in paper trading.
      Parameters:
      locateId - The locate ID. (required)
      Returns:
      Locate
      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 Returns the requested locate. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      404 Not found -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • getLocateWithHttpInfo

      public ApiResponse<Locate> getLocateWithHttpInfo(@Nonnull UUID locateId) throws ApiException
      Get Locate Returns a locate by ID. This endpoint is not available in paper trading.
      Parameters:
      locateId - The locate ID. (required)
      Returns:
      ApiResponse<Locate>
      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 Returns the requested locate. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      404 Not found -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • getLocateAsync

      public okhttp3.Call getLocateAsync(@Nonnull UUID locateId, ApiCallback<Locate> _callback) throws ApiException
      Get Locate (asynchronously) Returns a locate by ID. This endpoint is not available in paper trading.
      Parameters:
      locateId - The locate ID. (required)
      _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 Returns the requested locate. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      404 Not found -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocateQuotesCall

      public okhttp3.Call listLocateQuotesCall(@Nonnull String symbols, ApiCallback _callback) throws ApiException
      Build call for listLocateQuotes
      Parameters:
      symbols - Comma-separated list of stock symbols. Maximum 100 unique symbols. (required)
      _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 Returns locate quotes for the requested symbols. -
      400 Invalid locate quote request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocateQuotes

      public ListLocateQuotesResponse listLocateQuotes(@Nonnull String symbols) throws ApiException
      Get Locate Quotes Returns locate availability and pricing for one or more symbols. This endpoint is not available in paper trading.
      Parameters:
      symbols - Comma-separated list of stock symbols. Maximum 100 unique symbols. (required)
      Returns:
      ListLocateQuotesResponse
      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 Returns locate quotes for the requested symbols. -
      400 Invalid locate quote request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocateQuotesWithHttpInfo

      public ApiResponse<ListLocateQuotesResponse> listLocateQuotesWithHttpInfo(@Nonnull String symbols) throws ApiException
      Get Locate Quotes Returns locate availability and pricing for one or more symbols. This endpoint is not available in paper trading.
      Parameters:
      symbols - Comma-separated list of stock symbols. Maximum 100 unique symbols. (required)
      Returns:
      ApiResponse<ListLocateQuotesResponse>
      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 Returns locate quotes for the requested symbols. -
      400 Invalid locate quote request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocateQuotesAsync

      public okhttp3.Call listLocateQuotesAsync(@Nonnull String symbols, ApiCallback<ListLocateQuotesResponse> _callback) throws ApiException
      Get Locate Quotes (asynchronously) Returns locate availability and pricing for one or more symbols. This endpoint is not available in paper trading.
      Parameters:
      symbols - Comma-separated list of stock symbols. Maximum 100 unique symbols. (required)
      _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 Returns locate quotes for the requested symbols. -
      400 Invalid locate quote request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocatesCall

      public okhttp3.Call listLocatesCall(@Nullable String pageToken, @Nullable Integer limit, @Nullable LocateStatus status, @Nullable String symbol, @Nullable LocalDate start, @Nullable LocalDate end, ApiCallback _callback) throws ApiException
      Build call for listLocates
      Parameters:
      pageToken - Used for pagination, this token retrieves the next page of results. It is obtained from the response of the preceding page when additional pages are available. (optional)
      limit - Maximum number of results to return. (optional, default to 1000)
      status - Filter by locate status. (optional)
      symbol - Filter by stock symbol. (optional)
      start - Filter locates with locate trading date on or after this date. Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      end - Filter locates with locate trading date before this date (exclusive). Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (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 Returns a list of locates for the account, or an empty list if no locates are found. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocates

      public ListLocatesResponse listLocates(@Nullable String pageToken, @Nullable Integer limit, @Nullable LocateStatus status, @Nullable String symbol, @Nullable LocalDate start, @Nullable LocalDate end) throws ApiException
      List Locates Returns locates filtered by status, symbol, or date range. Results are sorted by `created_at` descending, with `id` descending as the tie-breaker. This endpoint is not available in paper trading.
      Parameters:
      pageToken - Used for pagination, this token retrieves the next page of results. It is obtained from the response of the preceding page when additional pages are available. (optional)
      limit - Maximum number of results to return. (optional, default to 1000)
      status - Filter by locate status. (optional)
      symbol - Filter by stock symbol. (optional)
      start - Filter locates with locate trading date on or after this date. Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      end - Filter locates with locate trading date before this date (exclusive). Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      Returns:
      ListLocatesResponse
      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 Returns a list of locates for the account, or an empty list if no locates are found. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocatesWithHttpInfo

      public ApiResponse<ListLocatesResponse> listLocatesWithHttpInfo(@Nullable String pageToken, @Nullable Integer limit, @Nullable LocateStatus status, @Nullable String symbol, @Nullable LocalDate start, @Nullable LocalDate end) throws ApiException
      List Locates Returns locates filtered by status, symbol, or date range. Results are sorted by `created_at` descending, with `id` descending as the tie-breaker. This endpoint is not available in paper trading.
      Parameters:
      pageToken - Used for pagination, this token retrieves the next page of results. It is obtained from the response of the preceding page when additional pages are available. (optional)
      limit - Maximum number of results to return. (optional, default to 1000)
      status - Filter by locate status. (optional)
      symbol - Filter by stock symbol. (optional)
      start - Filter locates with locate trading date on or after this date. Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      end - Filter locates with locate trading date before this date (exclusive). Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      Returns:
      ApiResponse<ListLocatesResponse>
      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 Returns a list of locates for the account, or an empty list if no locates are found. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -
    • listLocatesAsync

      public okhttp3.Call listLocatesAsync(@Nullable String pageToken, @Nullable Integer limit, @Nullable LocateStatus status, @Nullable String symbol, @Nullable LocalDate start, @Nullable LocalDate end, ApiCallback<ListLocatesResponse> _callback) throws ApiException
      List Locates (asynchronously) Returns locates filtered by status, symbol, or date range. Results are sorted by `created_at` descending, with `id` descending as the tie-breaker. This endpoint is not available in paper trading.
      Parameters:
      pageToken - Used for pagination, this token retrieves the next page of results. It is obtained from the response of the preceding page when additional pages are available. (optional)
      limit - Maximum number of results to return. (optional, default to 1000)
      status - Filter by locate status. (optional)
      symbol - Filter by stock symbol. (optional)
      start - Filter locates with locate trading date on or after this date. Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (optional)
      end - Filter locates with locate trading date before this date (exclusive). Format: YYYY-MM-DD. The locate trading date uses America/New_York and rolls at 8pm ET. (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 Returns a list of locates for the account, or an empty list if no locates are found. -
      400 Invalid locate request. -
      401 Authentication headers are missing or invalid. Make sure you authenticate your request with a valid API key. -
      403 User has no access to a resource. -
      500 Internal server error. We recommend retrying these later. If the issue persists, please contact us on Slack or on the Community Forum. -