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

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

  • getOptionContractSymbolOrId: Get an option contract by ID or Symbol
  • getOptionsContracts: Get Option Contracts
  • getV2Assets: Get Assets
  • getV2AssetsSymbolOrAssetId: Get an Asset by ID or Symbol
  • Constructor Details

    • AssetsApi

      public AssetsApi()
    • AssetsApi

      public AssetsApi(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)
    • getOptionContractSymbolOrIdCall

      public okhttp3.Call getOptionContractSymbolOrIdCall(@Nonnull String symbolOrId, ApiCallback _callback) throws ApiException
      Build call for getOptionContractSymbolOrId
      Parameters:
      symbolOrId - symbol or contract 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 An option contract -
      404 Not Found -
    • getOptionContractSymbolOrId

      public OptionContract getOptionContractSymbolOrId(@Nonnull String symbolOrId) throws ApiException
      Get an option contract by ID or Symbol Get an option contract by symbol or contract ID. The symbol or id should be passed in as a path parameter.
      Parameters:
      symbolOrId - symbol or contract ID (required)
      Returns:
      OptionContract
      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 An option contract -
      404 Not Found -
    • getOptionContractSymbolOrIdWithHttpInfo

      public ApiResponse<OptionContract> getOptionContractSymbolOrIdWithHttpInfo(@Nonnull String symbolOrId) throws ApiException
      Get an option contract by ID or Symbol Get an option contract by symbol or contract ID. The symbol or id should be passed in as a path parameter.
      Parameters:
      symbolOrId - symbol or contract ID (required)
      Returns:
      ApiResponse<OptionContract>
      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 An option contract -
      404 Not Found -
    • getOptionContractSymbolOrIdAsync

      public okhttp3.Call getOptionContractSymbolOrIdAsync(@Nonnull String symbolOrId, ApiCallback<OptionContract> _callback) throws ApiException
      Get an option contract by ID or Symbol (asynchronously) Get an option contract by symbol or contract ID. The symbol or id should be passed in as a path parameter.
      Parameters:
      symbolOrId - symbol or contract 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 An option contract -
      404 Not Found -
    • getOptionsContractsCall

      public okhttp3.Call getOptionsContractsCall(@Nullable String underlyingSymbols, @Nullable Boolean showDeliverables, @Nullable String status, @Nullable LocalDate expirationDate, @Nullable LocalDate expirationDateGte, @Nullable LocalDate expirationDateLte, @Nullable String rootSymbol, @Nullable OptionContractType type, @Nullable OptionContractStyle style, @Nullable BigDecimal strikePriceGte, @Nullable BigDecimal strikePriceLte, @Nullable String pageToken, @Nullable Integer limit, @Nullable Boolean ppind, ApiCallback _callback) throws ApiException
      Build call for getOptionsContracts
      Parameters:
      underlyingSymbols - Filter contracts by one or more underlying symbols. (optional)
      showDeliverables - Include deliverables array in the response. (optional)
      status - Filter contracts by status (active/inactive). By default only active contracts are returned. (optional)
      expirationDate - Filter contracts by the exact expiration date (format: YYYY-MM-DD). (optional)
      expirationDateGte - Filter contracts with expiration date greater than or equal to the specified date. (optional)
      expirationDateLte - Filter contracts with expiration date less than or equal to the specified date. By default this is set to the next weekend. (optional)
      rootSymbol - Filter contracts by the root symbol. (optional)
      type - Filter contracts by the type (call/put). (optional)
      style - Filter contracts by the style (american/european). (optional)
      strikePriceGte - Filter contracts with strike price greater than or equal to the specified value. (optional)
      strikePriceLte - Filter contracts with strike price less than or equal to the specified value. (optional)
      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 - The number of contracts to limit per page (default=100, max=10000). (optional)
      ppind - The ppind(Penny Program Indicator) field indicates whether an option contract is eligible for penny price increments, with `true` meaning it is part of the Penny Program and `false` meaning it is not. (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 Successful Response. -
    • getOptionsContracts

      public GetOptionsContracts200Response getOptionsContracts(@Nullable String underlyingSymbols, @Nullable Boolean showDeliverables, @Nullable String status, @Nullable LocalDate expirationDate, @Nullable LocalDate expirationDateGte, @Nullable LocalDate expirationDateLte, @Nullable String rootSymbol, @Nullable OptionContractType type, @Nullable OptionContractStyle style, @Nullable BigDecimal strikePriceGte, @Nullable BigDecimal strikePriceLte, @Nullable String pageToken, @Nullable Integer limit, @Nullable Boolean ppind) throws ApiException
      Get Option Contracts This endpoint allows you to retrieve a list of option contracts based on various filtering criteria. By default only active contracts that expire before the upcoming weekend are returned.
      Parameters:
      underlyingSymbols - Filter contracts by one or more underlying symbols. (optional)
      showDeliverables - Include deliverables array in the response. (optional)
      status - Filter contracts by status (active/inactive). By default only active contracts are returned. (optional)
      expirationDate - Filter contracts by the exact expiration date (format: YYYY-MM-DD). (optional)
      expirationDateGte - Filter contracts with expiration date greater than or equal to the specified date. (optional)
      expirationDateLte - Filter contracts with expiration date less than or equal to the specified date. By default this is set to the next weekend. (optional)
      rootSymbol - Filter contracts by the root symbol. (optional)
      type - Filter contracts by the type (call/put). (optional)
      style - Filter contracts by the style (american/european). (optional)
      strikePriceGte - Filter contracts with strike price greater than or equal to the specified value. (optional)
      strikePriceLte - Filter contracts with strike price less than or equal to the specified value. (optional)
      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 - The number of contracts to limit per page (default=100, max=10000). (optional)
      ppind - The ppind(Penny Program Indicator) field indicates whether an option contract is eligible for penny price increments, with `true` meaning it is part of the Penny Program and `false` meaning it is not. (optional)
      Returns:
      GetOptionsContracts200Response
      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 Successful Response. -
    • getOptionsContractsWithHttpInfo

      public ApiResponse<GetOptionsContracts200Response> getOptionsContractsWithHttpInfo(@Nullable String underlyingSymbols, @Nullable Boolean showDeliverables, @Nullable String status, @Nullable LocalDate expirationDate, @Nullable LocalDate expirationDateGte, @Nullable LocalDate expirationDateLte, @Nullable String rootSymbol, @Nullable OptionContractType type, @Nullable OptionContractStyle style, @Nullable BigDecimal strikePriceGte, @Nullable BigDecimal strikePriceLte, @Nullable String pageToken, @Nullable Integer limit, @Nullable Boolean ppind) throws ApiException
      Get Option Contracts This endpoint allows you to retrieve a list of option contracts based on various filtering criteria. By default only active contracts that expire before the upcoming weekend are returned.
      Parameters:
      underlyingSymbols - Filter contracts by one or more underlying symbols. (optional)
      showDeliverables - Include deliverables array in the response. (optional)
      status - Filter contracts by status (active/inactive). By default only active contracts are returned. (optional)
      expirationDate - Filter contracts by the exact expiration date (format: YYYY-MM-DD). (optional)
      expirationDateGte - Filter contracts with expiration date greater than or equal to the specified date. (optional)
      expirationDateLte - Filter contracts with expiration date less than or equal to the specified date. By default this is set to the next weekend. (optional)
      rootSymbol - Filter contracts by the root symbol. (optional)
      type - Filter contracts by the type (call/put). (optional)
      style - Filter contracts by the style (american/european). (optional)
      strikePriceGte - Filter contracts with strike price greater than or equal to the specified value. (optional)
      strikePriceLte - Filter contracts with strike price less than or equal to the specified value. (optional)
      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 - The number of contracts to limit per page (default=100, max=10000). (optional)
      ppind - The ppind(Penny Program Indicator) field indicates whether an option contract is eligible for penny price increments, with `true` meaning it is part of the Penny Program and `false` meaning it is not. (optional)
      Returns:
      ApiResponse<GetOptionsContracts200Response>
      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 Successful Response. -
    • getOptionsContractsAsync

      public okhttp3.Call getOptionsContractsAsync(@Nullable String underlyingSymbols, @Nullable Boolean showDeliverables, @Nullable String status, @Nullable LocalDate expirationDate, @Nullable LocalDate expirationDateGte, @Nullable LocalDate expirationDateLte, @Nullable String rootSymbol, @Nullable OptionContractType type, @Nullable OptionContractStyle style, @Nullable BigDecimal strikePriceGte, @Nullable BigDecimal strikePriceLte, @Nullable String pageToken, @Nullable Integer limit, @Nullable Boolean ppind, ApiCallback<GetOptionsContracts200Response> _callback) throws ApiException
      Get Option Contracts (asynchronously) This endpoint allows you to retrieve a list of option contracts based on various filtering criteria. By default only active contracts that expire before the upcoming weekend are returned.
      Parameters:
      underlyingSymbols - Filter contracts by one or more underlying symbols. (optional)
      showDeliverables - Include deliverables array in the response. (optional)
      status - Filter contracts by status (active/inactive). By default only active contracts are returned. (optional)
      expirationDate - Filter contracts by the exact expiration date (format: YYYY-MM-DD). (optional)
      expirationDateGte - Filter contracts with expiration date greater than or equal to the specified date. (optional)
      expirationDateLte - Filter contracts with expiration date less than or equal to the specified date. By default this is set to the next weekend. (optional)
      rootSymbol - Filter contracts by the root symbol. (optional)
      type - Filter contracts by the type (call/put). (optional)
      style - Filter contracts by the style (american/european). (optional)
      strikePriceGte - Filter contracts with strike price greater than or equal to the specified value. (optional)
      strikePriceLte - Filter contracts with strike price less than or equal to the specified value. (optional)
      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 - The number of contracts to limit per page (default=100, max=10000). (optional)
      ppind - The ppind(Penny Program Indicator) field indicates whether an option contract is eligible for penny price increments, with `true` meaning it is part of the Penny Program and `false` meaning it is not. (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 Successful Response. -
    • getV2AssetsCall

      public okhttp3.Call getV2AssetsCall(@Nullable String status, @Nullable String assetClass, @Nullable String exchange, @Nullable List<AssetAttribute> attributes, ApiCallback _callback) throws ApiException
      Build call for getV2Assets
      Parameters:
      status - e.g. \"active\". By default, all statuses are included. (optional)
      assetClass - Defaults to us_equity. (optional)
      exchange - Optional AMEX, ARCA, BATS, NYSE, NASDAQ, NYSEARCA, OTC or CRYPTO (optional)
      attributes - Comma separated values to query for more than one attribute. Assets which have any of the given attributes will be included. Supported values: - `ptp_no_exception`: Asset is a Publicly Traded Partnership (PTP) without a qualified notice; non-U.S. customers may incur 10% withholding on gross proceeds as per IRS guidance, and are blocked from being purchased by default. - `ptp_with_exception`: Users can open positions in these PTPs without general restrictions. - `ipo`: Accepting limit orders only before the stock begins trading on the secondary market. - `has_options`: The underlying equity has listed options available on the platform. Note: if the equity had inactive/expired contracts in the past, this will still show up. - `options_late_close`: Indicates the underlying asset's options contracts close at 4:15pm ET instead of the standard 4:00pm ET. - `fractional_eh_enabled`: Indicates the asset accepts fractional orders during extended hours sessions (pre-market, post-market, and overnight if enabled). - `overnight_tradable`: Asset is eligible for overnight (24x5) trading in supported venues on the platform. - `overnight_halted`: Asset is eligible for overnight trading but is currently halted/blocked for overnight sessions due to risk, corporate action, compliance, or venue constraints. (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 An array of asset objects -
    • getV2Assets

      public List<Assets> getV2Assets(@Nullable String status, @Nullable String assetClass, @Nullable String exchange, @Nullable List<AssetAttribute> attributes) throws ApiException
      Get Assets The assets API serves as the master list of assets available for trade and data consumption from Alpaca. Assets are sorted by asset class, exchange and symbol.
      Parameters:
      status - e.g. \"active\". By default, all statuses are included. (optional)
      assetClass - Defaults to us_equity. (optional)
      exchange - Optional AMEX, ARCA, BATS, NYSE, NASDAQ, NYSEARCA, OTC or CRYPTO (optional)
      attributes - Comma separated values to query for more than one attribute. Assets which have any of the given attributes will be included. Supported values: - `ptp_no_exception`: Asset is a Publicly Traded Partnership (PTP) without a qualified notice; non-U.S. customers may incur 10% withholding on gross proceeds as per IRS guidance, and are blocked from being purchased by default. - `ptp_with_exception`: Users can open positions in these PTPs without general restrictions. - `ipo`: Accepting limit orders only before the stock begins trading on the secondary market. - `has_options`: The underlying equity has listed options available on the platform. Note: if the equity had inactive/expired contracts in the past, this will still show up. - `options_late_close`: Indicates the underlying asset's options contracts close at 4:15pm ET instead of the standard 4:00pm ET. - `fractional_eh_enabled`: Indicates the asset accepts fractional orders during extended hours sessions (pre-market, post-market, and overnight if enabled). - `overnight_tradable`: Asset is eligible for overnight (24x5) trading in supported venues on the platform. - `overnight_halted`: Asset is eligible for overnight trading but is currently halted/blocked for overnight sessions due to risk, corporate action, compliance, or venue constraints. (optional)
      Returns:
      List<Assets>
      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 An array of asset objects -
    • getV2AssetsWithHttpInfo

      public ApiResponse<List<Assets>> getV2AssetsWithHttpInfo(@Nullable String status, @Nullable String assetClass, @Nullable String exchange, @Nullable List<AssetAttribute> attributes) throws ApiException
      Get Assets The assets API serves as the master list of assets available for trade and data consumption from Alpaca. Assets are sorted by asset class, exchange and symbol.
      Parameters:
      status - e.g. \"active\". By default, all statuses are included. (optional)
      assetClass - Defaults to us_equity. (optional)
      exchange - Optional AMEX, ARCA, BATS, NYSE, NASDAQ, NYSEARCA, OTC or CRYPTO (optional)
      attributes - Comma separated values to query for more than one attribute. Assets which have any of the given attributes will be included. Supported values: - `ptp_no_exception`: Asset is a Publicly Traded Partnership (PTP) without a qualified notice; non-U.S. customers may incur 10% withholding on gross proceeds as per IRS guidance, and are blocked from being purchased by default. - `ptp_with_exception`: Users can open positions in these PTPs without general restrictions. - `ipo`: Accepting limit orders only before the stock begins trading on the secondary market. - `has_options`: The underlying equity has listed options available on the platform. Note: if the equity had inactive/expired contracts in the past, this will still show up. - `options_late_close`: Indicates the underlying asset's options contracts close at 4:15pm ET instead of the standard 4:00pm ET. - `fractional_eh_enabled`: Indicates the asset accepts fractional orders during extended hours sessions (pre-market, post-market, and overnight if enabled). - `overnight_tradable`: Asset is eligible for overnight (24x5) trading in supported venues on the platform. - `overnight_halted`: Asset is eligible for overnight trading but is currently halted/blocked for overnight sessions due to risk, corporate action, compliance, or venue constraints. (optional)
      Returns:
      ApiResponse<List<Assets>>
      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 An array of asset objects -
    • getV2AssetsAsync

      public okhttp3.Call getV2AssetsAsync(@Nullable String status, @Nullable String assetClass, @Nullable String exchange, @Nullable List<AssetAttribute> attributes, ApiCallback<List<Assets>> _callback) throws ApiException
      Get Assets (asynchronously) The assets API serves as the master list of assets available for trade and data consumption from Alpaca. Assets are sorted by asset class, exchange and symbol.
      Parameters:
      status - e.g. \"active\". By default, all statuses are included. (optional)
      assetClass - Defaults to us_equity. (optional)
      exchange - Optional AMEX, ARCA, BATS, NYSE, NASDAQ, NYSEARCA, OTC or CRYPTO (optional)
      attributes - Comma separated values to query for more than one attribute. Assets which have any of the given attributes will be included. Supported values: - `ptp_no_exception`: Asset is a Publicly Traded Partnership (PTP) without a qualified notice; non-U.S. customers may incur 10% withholding on gross proceeds as per IRS guidance, and are blocked from being purchased by default. - `ptp_with_exception`: Users can open positions in these PTPs without general restrictions. - `ipo`: Accepting limit orders only before the stock begins trading on the secondary market. - `has_options`: The underlying equity has listed options available on the platform. Note: if the equity had inactive/expired contracts in the past, this will still show up. - `options_late_close`: Indicates the underlying asset's options contracts close at 4:15pm ET instead of the standard 4:00pm ET. - `fractional_eh_enabled`: Indicates the asset accepts fractional orders during extended hours sessions (pre-market, post-market, and overnight if enabled). - `overnight_tradable`: Asset is eligible for overnight (24x5) trading in supported venues on the platform. - `overnight_halted`: Asset is eligible for overnight trading but is currently halted/blocked for overnight sessions due to risk, corporate action, compliance, or venue constraints. (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 An array of asset objects -
    • getV2AssetsSymbolOrAssetIdCall

      public okhttp3.Call getV2AssetsSymbolOrAssetIdCall(@Nonnull String symbolOrAssetId, ApiCallback _callback) throws ApiException
      Build call for getV2AssetsSymbolOrAssetId
      Parameters:
      symbolOrAssetId - symbol or assetId. CUSIP is also accepted for US equities. (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 An Asset object -
      404 Not Found -
    • getV2AssetsSymbolOrAssetId

      public Assets getV2AssetsSymbolOrAssetId(@Nonnull String symbolOrAssetId) throws ApiException
      Get an Asset by ID or Symbol Get the asset model for a given symbol or asset_id. The symbol or asset_id should be passed in as a path parameter. **Note**: For crypto, the symbol has to follow old symbology, e.g. BTCUSD. **Note**: For coin pairs, the symbol should be separated by a slash (/), e.g. BTC/USDT. Since the slash is a special character in HTTP, use the URL encoded version instead, e.g. /v2/assets/BTC%2FUSDT
      Parameters:
      symbolOrAssetId - symbol or assetId. CUSIP is also accepted for US equities. (required)
      Returns:
      Assets
      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 An Asset object -
      404 Not Found -
    • getV2AssetsSymbolOrAssetIdWithHttpInfo

      public ApiResponse<Assets> getV2AssetsSymbolOrAssetIdWithHttpInfo(@Nonnull String symbolOrAssetId) throws ApiException
      Get an Asset by ID or Symbol Get the asset model for a given symbol or asset_id. The symbol or asset_id should be passed in as a path parameter. **Note**: For crypto, the symbol has to follow old symbology, e.g. BTCUSD. **Note**: For coin pairs, the symbol should be separated by a slash (/), e.g. BTC/USDT. Since the slash is a special character in HTTP, use the URL encoded version instead, e.g. /v2/assets/BTC%2FUSDT
      Parameters:
      symbolOrAssetId - symbol or assetId. CUSIP is also accepted for US equities. (required)
      Returns:
      ApiResponse<Assets>
      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 An Asset object -
      404 Not Found -
    • getV2AssetsSymbolOrAssetIdAsync

      public okhttp3.Call getV2AssetsSymbolOrAssetIdAsync(@Nonnull String symbolOrAssetId, ApiCallback<Assets> _callback) throws ApiException
      Get an Asset by ID or Symbol (asynchronously) Get the asset model for a given symbol or asset_id. The symbol or asset_id should be passed in as a path parameter. **Note**: For crypto, the symbol has to follow old symbology, e.g. BTCUSD. **Note**: For coin pairs, the symbol should be separated by a slash (/), e.g. BTC/USDT. Since the slash is a special character in HTTP, use the URL encoded version instead, e.g. /v2/assets/BTC%2FUSDT
      Parameters:
      symbolOrAssetId - symbol or assetId. CUSIP is also accepted for US equities. (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 An Asset object -
      404 Not Found -