# V1 ## Domain Types ### Security Type - `enum SecurityType:` Security type - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` # Accounts ## Get Accounts `AccountGetAccountsResponse v1().accounts().getAccounts(AccountGetAccountsParamsparams = AccountGetAccountsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts` List accounts the authenticated user has permission to access ### Parameters - `AccountGetAccountsParams params` - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class AccountGetAccountsResponse:` - `List data` - `long id` The unique identifier for the account - `long accountHolderEntityId` The account holder entity identifier - `String fullName` The full legal name of the account - `LocalDate openDate` The date the account was opened - `long optionsLevel` The options level of the account - `String shortName` The short name of the account - `AccountStatus status` The current status of the account - `ACTIVE("ACTIVE")` - `INACTIVE("INACTIVE")` - `CLOSED("CLOSED")` - `AccountSubtype subtype` The sub-type of account - `CASH("CASH")` - `MARGIN("MARGIN")` - `OTHER("OTHER")` - `AccountType type` The type of account - `CUSTOMER("CUSTOMER")` - `OTHER("OTHER")` - `Optional closeDate` The date the account was closed, if applicable ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.accounts.AccountGetAccountsParams; import com.clear_street.api.models.v1.accounts.AccountGetAccountsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); AccountGetAccountsResponse response = client.v1().accounts().getAccounts(); } } ``` #### Response ```json { "data": [ { "account_holder_entity_id": 987654321, "close_date": null, "full_name": "Test Trading Account", "id": 19816, "open_date": "2023-01-15", "short_name": "TST-ACCOUNT-01", "status": "ACTIVE", "subtype": "MARGIN", "type": "CUSTOMER" }, { "account_holder_entity_id": 987654322, "close_date": "2024-08-01", "full_name": "Old Test Account", "id": 19817, "open_date": "2021-05-20", "short_name": "TST-ACCOUNT-02-CLOSED", "status": "CLOSED", "subtype": "CASH", "type": "CUSTOMER" } ], "error": null, "metadata": { "next_page_token": "cGFnZT0yJmxhc3RfaWQ9MTk4MTc=", "page_number": 1, "request_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "total_items": 25, "total_pages": 3 } } ``` ## Get Account By ID `AccountGetAccountByIdResponse v1().accounts().getAccountById(AccountGetAccountByIdParamsparams = AccountGetAccountByIdParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}` Fetch account details by ID ### Parameters - `AccountGetAccountByIdParams params` - `Optional accountId` ### Returns - `class AccountGetAccountByIdResponse:` - `Account data` Represents a trading account - `long id` The unique identifier for the account - `long accountHolderEntityId` The account holder entity identifier - `String fullName` The full legal name of the account - `LocalDate openDate` The date the account was opened - `long optionsLevel` The options level of the account - `String shortName` The short name of the account - `AccountStatus status` The current status of the account - `ACTIVE("ACTIVE")` - `INACTIVE("INACTIVE")` - `CLOSED("CLOSED")` - `AccountSubtype subtype` The sub-type of account - `CASH("CASH")` - `MARGIN("MARGIN")` - `OTHER("OTHER")` - `AccountType type` The type of account - `CUSTOMER("CUSTOMER")` - `OTHER("OTHER")` - `Optional closeDate` The date the account was closed, if applicable ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.accounts.AccountGetAccountByIdParams; import com.clear_street.api.models.v1.accounts.AccountGetAccountByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); AccountGetAccountByIdResponse response = client.v1().accounts().getAccountById(0L); } } ``` #### Response ```json { "data": { "account_holder_entity_id": 987654321, "close_date": null, "full_name": "Test Trading Account", "id": 19816, "open_date": "2023-01-15", "short_name": "TST-ACCOUNT-01", "status": "ACTIVE", "subtype": "MARGIN", "type": "CUSTOMER" }, "error": null, "metadata": { "request_id": "b7e2d3f4-a1b2-4c3d-8e4f-5a6b7c8d9e0f" } } ``` ## Patch Account By ID `AccountPatchAccountByIdResponse v1().accounts().patchAccountById(AccountPatchAccountByIdParamsparams = AccountPatchAccountByIdParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **patch** `/v1/accounts/{account_id}` Update account risk settings ### Parameters - `AccountPatchAccountByIdParams params` - `Optional accountId` - `Optional risk` Risk settings for the account ### Returns - `class AccountPatchAccountByIdResponse:` - `AccountSettings data` - `Optional risk` Risk settings for the account - `Optional maxNotional` The maximum notional value available to the account ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.accounts.AccountPatchAccountByIdParams; import com.clear_street.api.models.v1.accounts.AccountPatchAccountByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); AccountPatchAccountByIdResponse response = client.v1().accounts().patchAccountById(0L); } } ``` #### Response ```json { "data": { "risk": { "max_notional": "5000000.00" } }, "error": null, "metadata": { "request_id": "c8f3e4a5-b2c3-5d4e-9f0a-6b7c8d9e0f1a" } } ``` ## Get Account Balances `AccountGetAccountBalancesResponse v1().accounts().getAccountBalances(AccountGetAccountBalancesParamsparams = AccountGetAccountBalancesParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/balances` Fetch account balance information ### Parameters - `AccountGetAccountBalancesParams params` - `Optional accountId` - `Optional topMarginContributorsLimit` Limit the number of top margin contributors returned by the engine. ### Returns - `class AccountGetAccountBalancesResponse:` - `AccountBalances data` Represents the balance details for a trading account - `long accountId` The unique identifier for the account - `String buyingPower` The total buying power available in the account. - `String currency` Currency identifier for all monetary values. - `String dailyRealizedPnl` Realized profit or loss since start of day. - `String dailyTotalPnl` Total profit or loss since start of day. - `String dailyUnrealizedPnl` Total unrealized profit or loss across all positions relative to prior close. - `String equity` The total equity in the account. - `String longMarketValue` The total market value of all long positions. - `MarginType marginType` The applicable margin model for the account - `OTHER("OTHER")` - `NONE("NONE")` - `PORTFOLIO_MARGIN("PORTFOLIO_MARGIN")` - `RISK_BASED_HAIRCUT_BROKER_DEALER("RISK_BASED_HAIRCUT_BROKER_DEALER")` - `REG_T("REG_T")` - `RISK_BASED_HAIRCUT_MARKET_MAKER("RISK_BASED_HAIRCUT_MARKET_MAKER")` - `CIRO("CIRO")` - `FUTURES_NLV("FUTURES_NLV")` - `FUTURES_TOT_EQ("FUTURES_TOT_EQ")` - `String openOrderAdjustment` Signed buying-power correction from open orders. - `String settledCash` The amount of cash that is settled and available for withdrawal or trading. - `AccountBalancesSod sod` Start-of-day snapshot balances. - `String buyingPower` Start-of-day buying power. - `String equity` Start-of-day equity. - `String longMarketValue` Start-of-day long market value. - `String shortMarketValue` Start-of-day short market value. - `Optional asof` Timestamp for the start-of-day values. - `Optional dayTradeBuyingPower` Start-of-day day-trade buying power. - `Optional maintenanceMarginExcess` Start-of-day maintenance margin excess. - `Optional maintenanceMarginRequirement` Start-of-day maintenance margin requirement. - `Optional tradeCash` Start-of-day trade cash. - `String tradeCash` Trade-date effective cash. - `String unsettledCredits` Trade-date unsettled cash credits. - `String unsettledDebits` Trade-date unsettled cash debits. - `String withdrawableCash` The amount of cash currently available to withdraw. - `Optional marginDetails` Margin-account-only details. - `long dayTradeCount` The number of day trades executed over the 5 most recent trading days. - `String initialMarginExcess` Initial margin excess for trade-date balances. - `String initialMarginRequirement` Initial margin requirement for trade-date balances. - `String maintenanceMarginExcess` Maintenance margin excess for trade-date balances. - `String maintenanceMarginRequirement` Maintenance margin requirement for trade-date balances. - `boolean patternDayTrader` `true` if the account is currently flagged as a PDT, otherwise `false`. - `Optional dayTradeBuyingPowerUsage` The amount of day-trade buying power used during the current trading day. - `Optional> topContributors` Optional top margin contributors, returned only when explicitly requested. - `String dayTradeBuyingPowerUsage` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `String initialMarginRequirement` Initial margin requirement attributable to this underlying. - `String maintenanceMarginRequirement` Maintenance margin requirement attributable to this underlying. - `String marketValue` Net market value attributable to this underlying. - `String underlyingInstrumentId` UUID of the underlying security contributing to margin requirement. - `Optional usage` Current usage totals. - `String total` The total margin available in the current model. - `String used` The amount of margin that is currently being utilized. - `Optional multiplier` Applied multiplier for margin calculations. - `Optional shortMarketValue` The total market value of all short positions. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.accounts.AccountGetAccountBalancesParams; import com.clear_street.api.models.v1.accounts.AccountGetAccountBalancesResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); AccountGetAccountBalancesResponse response = client.v1().accounts().getAccountBalances(0L); } } ``` #### Response ```json { "data": { "account_id": 19816, "buying_power": "45000.00", "currency": "USD", "daily_realized_pnl": "700.00", "daily_total_pnl": "1250.00", "daily_unrealized_pnl": "550.00", "equity": "100000.00", "long_market_value": "30000.00", "margin_type": "NONE", "open_order_adjustment": "-5000.00", "settled_cash": "60000.00", "sod": { "asof": "2023-09-27", "buying_power": "45000.00", "equity": "100000.00", "long_market_value": "30000.00" }, "trade_cash": "60000.00", "unsettled_credits": "20000.00", "unsettled_debits": "10000.00", "withdrawable_cash": "55000.00" }, "error": null, "metadata": { "request_id": "b7e2d3f4-a1b2-4c3d-8e4f-5a6b7c8d9e0f" } } ``` ## Get Portfolio History `AccountGetPortfolioHistoryResponse v1().accounts().getPortfolioHistory(AccountGetPortfolioHistoryParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/portfolio-history` Retrieves daily portfolio history for the specified account. ### Parameters - `AccountGetPortfolioHistoryParams params` - `Optional accountId` - `LocalDate startDate` Start date for the portfolio history range, in YYYY-MM-DD format. - `Optional endDate` Defaults to today in America/New_York when omitted. ### Returns - `class AccountGetPortfolioHistoryResponse:` - `PortfolioHistoryResponse data` - `List segments` - `LocalDate date` The date for this segment - `String eodEquity` The equity at the end of the trading day. - `String realizedPnl` Sum of the profit and loss realized from position closing trading activity. - `String sodEquity` The equity at the start of the trading day. - `String unrealizedPnl` Sum of the profit and loss from market changes. - `Optional boughtNotional` Amount bought MTM - `Optional dayPnl` Sum of the profit and loss from intraday trading activities for the trading day. - `Optional netPnl` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `Optional positionPnl` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `Optional soldNotional` Amount sold MTM ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.accounts.AccountGetPortfolioHistoryParams; import com.clear_street.api.models.v1.accounts.AccountGetPortfolioHistoryResponse; import java.time.LocalDate; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); AccountGetPortfolioHistoryParams params = AccountGetPortfolioHistoryParams.builder() .accountId(0L) .startDate(LocalDate.parse("2019-12-27")) .build(); AccountGetPortfolioHistoryResponse response = client.v1().accounts().getPortfolioHistory(params); } } ``` #### Response ```json { "data": { "segments": [ { "bought_notional": "39800.00", "date": "2026-04-15", "day_pnl": "850.25", "eod_equity": "100850.25", "net_pnl": "850.25", "position_pnl": "-350.25", "realized_pnl": "1200.50", "sod_equity": "100000.00", "sold_notional": "42500.00", "unrealized_pnl": "-350.25" } ] }, "error": null, "metadata": { "request_id": "f076d6f6-10c9-42a0-98c5-18cebc427e80" } } ``` ## Domain Types ### Account - `class Account:` Represents a trading account - `long id` The unique identifier for the account - `long accountHolderEntityId` The account holder entity identifier - `String fullName` The full legal name of the account - `LocalDate openDate` The date the account was opened - `long optionsLevel` The options level of the account - `String shortName` The short name of the account - `AccountStatus status` The current status of the account - `ACTIVE("ACTIVE")` - `INACTIVE("INACTIVE")` - `CLOSED("CLOSED")` - `AccountSubtype subtype` The sub-type of account - `CASH("CASH")` - `MARGIN("MARGIN")` - `OTHER("OTHER")` - `AccountType type` The type of account - `CUSTOMER("CUSTOMER")` - `OTHER("OTHER")` - `Optional closeDate` The date the account was closed, if applicable ### Account Balances - `class AccountBalances:` Represents the balance details for a trading account - `long accountId` The unique identifier for the account - `String buyingPower` The total buying power available in the account. - `String currency` Currency identifier for all monetary values. - `String dailyRealizedPnl` Realized profit or loss since start of day. - `String dailyTotalPnl` Total profit or loss since start of day. - `String dailyUnrealizedPnl` Total unrealized profit or loss across all positions relative to prior close. - `String equity` The total equity in the account. - `String longMarketValue` The total market value of all long positions. - `MarginType marginType` The applicable margin model for the account - `OTHER("OTHER")` - `NONE("NONE")` - `PORTFOLIO_MARGIN("PORTFOLIO_MARGIN")` - `RISK_BASED_HAIRCUT_BROKER_DEALER("RISK_BASED_HAIRCUT_BROKER_DEALER")` - `REG_T("REG_T")` - `RISK_BASED_HAIRCUT_MARKET_MAKER("RISK_BASED_HAIRCUT_MARKET_MAKER")` - `CIRO("CIRO")` - `FUTURES_NLV("FUTURES_NLV")` - `FUTURES_TOT_EQ("FUTURES_TOT_EQ")` - `String openOrderAdjustment` Signed buying-power correction from open orders. - `String settledCash` The amount of cash that is settled and available for withdrawal or trading. - `AccountBalancesSod sod` Start-of-day snapshot balances. - `String buyingPower` Start-of-day buying power. - `String equity` Start-of-day equity. - `String longMarketValue` Start-of-day long market value. - `String shortMarketValue` Start-of-day short market value. - `Optional asof` Timestamp for the start-of-day values. - `Optional dayTradeBuyingPower` Start-of-day day-trade buying power. - `Optional maintenanceMarginExcess` Start-of-day maintenance margin excess. - `Optional maintenanceMarginRequirement` Start-of-day maintenance margin requirement. - `Optional tradeCash` Start-of-day trade cash. - `String tradeCash` Trade-date effective cash. - `String unsettledCredits` Trade-date unsettled cash credits. - `String unsettledDebits` Trade-date unsettled cash debits. - `String withdrawableCash` The amount of cash currently available to withdraw. - `Optional marginDetails` Margin-account-only details. - `long dayTradeCount` The number of day trades executed over the 5 most recent trading days. - `String initialMarginExcess` Initial margin excess for trade-date balances. - `String initialMarginRequirement` Initial margin requirement for trade-date balances. - `String maintenanceMarginExcess` Maintenance margin excess for trade-date balances. - `String maintenanceMarginRequirement` Maintenance margin requirement for trade-date balances. - `boolean patternDayTrader` `true` if the account is currently flagged as a PDT, otherwise `false`. - `Optional dayTradeBuyingPowerUsage` The amount of day-trade buying power used during the current trading day. - `Optional> topContributors` Optional top margin contributors, returned only when explicitly requested. - `String dayTradeBuyingPowerUsage` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `String initialMarginRequirement` Initial margin requirement attributable to this underlying. - `String maintenanceMarginRequirement` Maintenance margin requirement attributable to this underlying. - `String marketValue` Net market value attributable to this underlying. - `String underlyingInstrumentId` UUID of the underlying security contributing to margin requirement. - `Optional usage` Current usage totals. - `String total` The total margin available in the current model. - `String used` The amount of margin that is currently being utilized. - `Optional multiplier` Applied multiplier for margin calculations. - `Optional shortMarketValue` The total market value of all short positions. ### Account Balances Sod - `class AccountBalancesSod:` - `String buyingPower` Start-of-day buying power. - `String equity` Start-of-day equity. - `String longMarketValue` Start-of-day long market value. - `String shortMarketValue` Start-of-day short market value. - `Optional asof` Timestamp for the start-of-day values. - `Optional dayTradeBuyingPower` Start-of-day day-trade buying power. - `Optional maintenanceMarginExcess` Start-of-day maintenance margin excess. - `Optional maintenanceMarginRequirement` Start-of-day maintenance margin requirement. - `Optional tradeCash` Start-of-day trade cash. ### Account Settings - `class AccountSettings:` - `Optional risk` Risk settings for the account - `Optional maxNotional` The maximum notional value available to the account ### Account Status - `enum AccountStatus:` Account status - `ACTIVE("ACTIVE")` - `INACTIVE("INACTIVE")` - `CLOSED("CLOSED")` ### Account Subtype - `enum AccountSubtype:` Account subtype classification providing more granular categorization - `CASH("CASH")` - `MARGIN("MARGIN")` - `OTHER("OTHER")` ### Account Type - `enum AccountType:` Account type classification - `CUSTOMER("CUSTOMER")` - `OTHER("OTHER")` ### Margin Details - `class MarginDetails:` - `long dayTradeCount` The number of day trades executed over the 5 most recent trading days. - `String initialMarginExcess` Initial margin excess for trade-date balances. - `String initialMarginRequirement` Initial margin requirement for trade-date balances. - `String maintenanceMarginExcess` Maintenance margin excess for trade-date balances. - `String maintenanceMarginRequirement` Maintenance margin requirement for trade-date balances. - `boolean patternDayTrader` `true` if the account is currently flagged as a PDT, otherwise `false`. - `Optional dayTradeBuyingPowerUsage` The amount of day-trade buying power used during the current trading day. - `Optional> topContributors` Optional top margin contributors, returned only when explicitly requested. - `String dayTradeBuyingPowerUsage` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `String initialMarginRequirement` Initial margin requirement attributable to this underlying. - `String maintenanceMarginRequirement` Maintenance margin requirement attributable to this underlying. - `String marketValue` Net market value attributable to this underlying. - `String underlyingInstrumentId` UUID of the underlying security contributing to margin requirement. - `Optional usage` Current usage totals. - `String total` The total margin available in the current model. - `String used` The amount of margin that is currently being utilized. ### Margin Details Usage - `class MarginDetailsUsage:` - `String total` The total margin available in the current model. - `String used` The amount of margin that is currently being utilized. ### Margin Top Contributor - `class MarginTopContributor:` - `String dayTradeBuyingPowerUsage` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `String initialMarginRequirement` Initial margin requirement attributable to this underlying. - `String maintenanceMarginRequirement` Maintenance margin requirement attributable to this underlying. - `String marketValue` Net market value attributable to this underlying. - `String underlyingInstrumentId` UUID of the underlying security contributing to margin requirement. ### Margin Type - `enum MarginType:` An account's margin type - `OTHER("OTHER")` - `NONE("NONE")` - `PORTFOLIO_MARGIN("PORTFOLIO_MARGIN")` - `RISK_BASED_HAIRCUT_BROKER_DEALER("RISK_BASED_HAIRCUT_BROKER_DEALER")` - `REG_T("REG_T")` - `RISK_BASED_HAIRCUT_MARKET_MAKER("RISK_BASED_HAIRCUT_MARKET_MAKER")` - `CIRO("CIRO")` - `FUTURES_NLV("FUTURES_NLV")` - `FUTURES_TOT_EQ("FUTURES_TOT_EQ")` ### Portfolio History Response - `class PortfolioHistoryResponse:` - `List segments` - `LocalDate date` The date for this segment - `String eodEquity` The equity at the end of the trading day. - `String realizedPnl` Sum of the profit and loss realized from position closing trading activity. - `String sodEquity` The equity at the start of the trading day. - `String unrealizedPnl` Sum of the profit and loss from market changes. - `Optional boughtNotional` Amount bought MTM - `Optional dayPnl` Sum of the profit and loss from intraday trading activities for the trading day. - `Optional netPnl` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `Optional positionPnl` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `Optional soldNotional` Amount sold MTM ### Portfolio History Segment - `class PortfolioHistorySegment:` - `LocalDate date` The date for this segment - `String eodEquity` The equity at the end of the trading day. - `String realizedPnl` Sum of the profit and loss realized from position closing trading activity. - `String sodEquity` The equity at the start of the trading day. - `String unrealizedPnl` Sum of the profit and loss from market changes. - `Optional boughtNotional` Amount bought MTM - `Optional dayPnl` Sum of the profit and loss from intraday trading activities for the trading day. - `Optional netPnl` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `Optional positionPnl` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `Optional soldNotional` Amount sold MTM ### Risk Settings - `class RiskSettings:` Risk settings for an account - `Optional maxNotional` The maximum notional value available to the account # API Version ## Get the API version. `ApiVersionGetVersionResponse v1().apiVersion().getVersion(ApiVersionGetVersionParamsparams = ApiVersionGetVersionParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/version` Returns the current version string for this API endpoint. ### Parameters - `ApiVersionGetVersionParams params` ### Returns - `class ApiVersionGetVersionResponse:` - `Version data` API version information - `String version` API version string ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.apiversion.ApiVersionGetVersionParams; import com.clear_street.api.models.v1.apiversion.ApiVersionGetVersionResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ApiVersionGetVersionResponse response = client.v1().apiVersion().getVersion(); } } ``` #### Response ```json { "data": { "version": "2025-10-31" }, "error": null, "metadata": { "request_id": "2c3d4e5f-6a7b-8c9d-0e1f-2a3b4c5d6e7f" } } ``` ## Domain Types ### Version - `class Version:` API version information - `String version` API version string # Calendar ## Get Clock `CalendarGetClockResponse v1().calendar().getClock(CalendarGetClockParamsparams = CalendarGetClockParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/clock` Returns the current server time in UTC. ### Parameters - `CalendarGetClockParams params` ### Returns - `class CalendarGetClockResponse:` - `ClockDetail data` Current server time and market clock information - `LocalDateTime clock` Current server time in UTC ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.calendar.CalendarGetClockParams; import com.clear_street.api.models.v1.calendar.CalendarGetClockResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); CalendarGetClockResponse response = client.v1().calendar().getClock(); } } ``` #### Response ```json { "data": { "clock": "2025-03-01T03:35:00.000000000Z" }, "error": null, "metadata": { "request_id": "1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e" } } ``` ## Get Market Hours Calendar. `CalendarGetMarketHoursCalendarResponse v1().calendar().getMarketHoursCalendar(CalendarGetMarketHoursCalendarParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/calendars/market-hours` Retrieves comprehensive trading hours including pre-market, regular, and after-hours sessions. Returns market status, session times, and next session schedules. ### Parameters - `CalendarGetMarketHoursCalendarParams params` - `String date` The date to query market hours for (YYYY-MM-DD). Defaults to today. - `Optional market` Market type to query (us_equities, us_options). If omitted, returns all markets. ### Returns - `class CalendarGetMarketHoursCalendarResponse:` - `List data` - `LocalDateTime currentTime` Current time in market timezone with offset - `LocalDate date` The date for which market hours are provided - `MarketType market` Market type identifier - `US_EQUITIES("us_equities")` - `US_OPTIONS("us_options")` - `String marketName` Human-readable market name - `TradingSessions nextSessions` Next trading day's session schedules (without time_until fields) - `Optional afterHours` After-hours session schedule, null if not available - `LocalDateTime close` Session close timestamp with timezone offset - `LocalDateTime open` Session open timestamp with timezone offset - `Optional timeUntilClose` ISO 8601 duration until session closes. Null if session is not currently open. - `Optional timeUntilOpen` ISO 8601 duration until session opens. Null if session has already started or closed. - `Optional preMarket` Pre-market session schedule, null if not available - `Optional regular` Regular trading session schedule, null if holiday/weekend - `MarketStatus status` Market status information - `DayType dayType` The type of trading day - `TRADING_DAY("TRADING_DAY")` - `EARLY_CLOSE("EARLY_CLOSE")` - `HOLIDAY("HOLIDAY")` - `WEEKEND("WEEKEND")` - `boolean isOpen` Whether the market is currently open (real-time) - `Optional currentSession` Current session type if market is open, null if closed - `PRE_MARKET("pre_market")` - `REGULAR("regular")` - `AFTER_HOURS("after_hours")` - `String timezone` IANA timezone identifier for the market - `TradingSessions todaySessions` Trading session schedules for the requested date with time_until fields ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.calendar.CalendarGetMarketHoursCalendarParams; import com.clear_street.api.models.v1.calendar.CalendarGetMarketHoursCalendarResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); CalendarGetMarketHoursCalendarParams params = CalendarGetMarketHoursCalendarParams.builder() .date("date") .build(); CalendarGetMarketHoursCalendarResponse response = client.v1().calendar().getMarketHoursCalendar(params); } } ``` #### Response ```json { "data": [ { "current_time": "2025-11-28T11:00:00-05:00", "date": "2025-11-28", "market": "us_equities", "market_name": "US Equities", "next_sessions": { "after_hours": { "close": "2025-12-01T20:00:00-05:00", "open": "2025-12-01T16:00:00-05:00" }, "pre_market": { "close": "2025-12-01T09:30:00-05:00", "open": "2025-12-01T04:00:00-05:00" }, "regular": { "close": "2025-12-01T16:00:00-05:00", "open": "2025-12-01T09:30:00-05:00" } }, "status": { "current_session": "regular", "day_type": "EARLY_CLOSE", "is_open": true }, "timezone": "America/New_York", "today_sessions": { "pre_market": { "close": "2025-11-28T09:30:00-05:00", "open": "2025-11-28T04:00:00-05:00" }, "regular": { "close": "2025-11-28T13:00:00-05:00", "open": "2025-11-28T09:30:00-05:00", "time_until_close": "PT2H" } } } ], "error": null, "metadata": { "request_id": "3d4e5f6a-7b8c-9d0e-1f2a-3b4c5d6e7f8a" } } ``` ## Domain Types ### Clock Detail - `class ClockDetail:` Current server time and market clock information - `LocalDateTime clock` Current server time in UTC ### Day Type - `enum DayType:` Day type for market hours - indicates the type of trading day - `TRADING_DAY("TRADING_DAY")` - `EARLY_CLOSE("EARLY_CLOSE")` - `HOLIDAY("HOLIDAY")` - `WEEKEND("WEEKEND")` ### Market Hours Detail - `class MarketHoursDetail:` Comprehensive market hours information for a specific market and date - `LocalDateTime currentTime` Current time in market timezone with offset - `LocalDate date` The date for which market hours are provided - `MarketType market` Market type identifier - `US_EQUITIES("us_equities")` - `US_OPTIONS("us_options")` - `String marketName` Human-readable market name - `TradingSessions nextSessions` Next trading day's session schedules (without time_until fields) - `Optional afterHours` After-hours session schedule, null if not available - `LocalDateTime close` Session close timestamp with timezone offset - `LocalDateTime open` Session open timestamp with timezone offset - `Optional timeUntilClose` ISO 8601 duration until session closes. Null if session is not currently open. - `Optional timeUntilOpen` ISO 8601 duration until session opens. Null if session has already started or closed. - `Optional preMarket` Pre-market session schedule, null if not available - `Optional regular` Regular trading session schedule, null if holiday/weekend - `MarketStatus status` Market status information - `DayType dayType` The type of trading day - `TRADING_DAY("TRADING_DAY")` - `EARLY_CLOSE("EARLY_CLOSE")` - `HOLIDAY("HOLIDAY")` - `WEEKEND("WEEKEND")` - `boolean isOpen` Whether the market is currently open (real-time) - `Optional currentSession` Current session type if market is open, null if closed - `PRE_MARKET("pre_market")` - `REGULAR("regular")` - `AFTER_HOURS("after_hours")` - `String timezone` IANA timezone identifier for the market - `TradingSessions todaySessions` Trading session schedules for the requested date with time_until fields ### Market Session Type - `enum MarketSessionType:` Session type for market hours - `PRE_MARKET("pre_market")` - `REGULAR("regular")` - `AFTER_HOURS("after_hours")` ### Market Status - `class MarketStatus:` Market status information - `DayType dayType` The type of trading day - `TRADING_DAY("TRADING_DAY")` - `EARLY_CLOSE("EARLY_CLOSE")` - `HOLIDAY("HOLIDAY")` - `WEEKEND("WEEKEND")` - `boolean isOpen` Whether the market is currently open (real-time) - `Optional currentSession` Current session type if market is open, null if closed - `PRE_MARKET("pre_market")` - `REGULAR("regular")` - `AFTER_HOURS("after_hours")` ### Market Type - `enum MarketType:` Market type for market hours calendar endpoint - `US_EQUITIES("us_equities")` - `US_OPTIONS("us_options")` ### Session Schedule - `class SessionSchedule:` Session schedule with open and close timestamps - `LocalDateTime close` Session close timestamp with timezone offset - `LocalDateTime open` Session open timestamp with timezone offset - `Optional timeUntilClose` ISO 8601 duration until session closes. Null if session is not currently open. - `Optional timeUntilOpen` ISO 8601 duration until session opens. Null if session has already started or closed. ### Trading Sessions - `class TradingSessions:` Trading sessions for a market day with full timestamps - `Optional afterHours` After-hours session schedule, null if not available - `LocalDateTime close` Session close timestamp with timezone offset - `LocalDateTime open` Session open timestamp with timezone offset - `Optional timeUntilClose` ISO 8601 duration until session closes. Null if session is not currently open. - `Optional timeUntilOpen` ISO 8601 duration until session opens. Null if session has already started or closed. - `Optional preMarket` Pre-market session schedule, null if not available - `Optional regular` Regular trading session schedule, null if holiday/weekend # Instrument Data ## Get All Instrument Events `InstrumentDataGetAllInstrumentEventsResponse v1().instrumentData().getAllInstrumentEvents(InstrumentDataGetAllInstrumentEventsParamsparams = InstrumentDataGetAllInstrumentEventsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/events` List instrument events across all securities. Retrieves all instrument events grouped by date. ### Parameters - `InstrumentDataGetAllInstrumentEventsParams params` - `Optional> eventTypes` Filter by event type(s). Comma-delimited list. Example: `event_types=EARNINGS,IPO`. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` - `Optional fromDate` The start date for the query range, inclusive (YYYY-MM-DD). - `Optional> instrumentIds` Filter by OEMS instrument ID(s). Comma-delimited list of UUIDs. Example: `instrument_ids=550e8400-e29b-41d4-a716-446655440000`. - `Optional toDate` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `class InstrumentDataGetAllInstrumentEventsResponse:` - `InstrumentAllEventsData data` All-events payload grouped by date. - `List eventDates` Events grouped by date in descending order. - `LocalDate date` Event date. - `List events` Flat event envelopes for this date. - `String symbol` Symbol associated with the event. - `AllEventsEventType type` Event type discriminator. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` - `Optional dividendEventData` Dividend payload when type is DIVIDEND. - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `Optional earningsEventData` Earnings payload when type is EARNINGS. - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `Optional instrumentId` OEMS instrument identifier, when the instrument is found in the instrument cache. - `Optional ipoEventData` IPO payload when type is IPO. - `Optional actions` IPO action. - `Optional announcedAt` IPO announced timestamp. - `Optional company` IPO company name. - `Optional exchange` IPO exchange. - `Optional marketCap` IPO market cap. - `Optional priceRange` IPO price range. - `Optional shares` IPO shares offered. - `Optional name` Instrument name associated with the event, when available. - `Optional reportingCurrency` The currency used for reporting financial data. - `Optional stockSplitEventData` Stock split payload when type is STOCK_SPLIT. - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetAllInstrumentEventsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetAllInstrumentEventsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetAllInstrumentEventsResponse response = client.v1().instrumentData().getAllInstrumentEvents(); } } ``` #### Response ```json { "data": { "event_dates": [ { "date": "2026-04-23", "events": [ { "dividend_event_data": { "adjusted_dividend_amount": "0.5236", "declaration_date": "2026-04-22", "dividend_amount": "0.5236", "dividend_yield": "43.82881469863321", "ex_date": "2026-04-23", "frequency": "Weekly", "payment_date": "2026-04-24", "record_date": "2026-04-23" }, "instrument_id": "2281b543-7136-4008-aa0a-a402bf9d9f90", "name": "YieldMax ABNB Option Income Strategy ETF", "reporting_currency": "USD", "symbol": "ABNY", "type": "DIVIDEND" }, { "dividend_event_data": { "adjusted_dividend_amount": "0.1432", "declaration_date": "2026-04-22", "dividend_amount": "0.1432", "dividend_yield": "181.7918287937743", "ex_date": "2026-04-23", "frequency": "Weekly", "payment_date": "2026-04-24", "record_date": "2026-04-23" }, "instrument_id": "4b33fa52-8ab6-43f5-a8df-042e0c63d20e", "name": "YieldMax AI Option Income Strategy ETF", "reporting_currency": "USD", "symbol": "AIYY", "type": "DIVIDEND" } ] } ] }, "metadata": { "request_id": "5efbf08a-9067-4491-9f29-cf0b233507ef" } } ``` ## Get Instrument Events `InstrumentDataGetInstrumentEventsResponse v1().instrumentData().getInstrumentEvents(InstrumentDataGetInstrumentEventsParamsparams = InstrumentDataGetInstrumentEventsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/events` Retrieves corporate events (dividends, splits, etc.) for an instrument, grouped by event type. Date range defaults: - `from_date`: today - 365 days - `to_date`: today + 60 days ### Parameters - `InstrumentDataGetInstrumentEventsParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional fromDate` The start date for the query range, inclusive (YYYY-MM-DD). - `Optional toDate` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `class InstrumentDataGetInstrumentEventsResponse:` - `InstrumentEventsData data` Grouped instrument events by type - `List dividends` Dividend distribution events - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `List earnings` Earnings announcement events - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `String instrumentId` OEMS instrument UUID from the request - `List splits` Stock split events - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") - `Optional reportingCurrency` The currency used for reporting financial data ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentEventsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentEventsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentEventsResponse response = client.v1().instrumentData().getInstrumentEvents("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": { "dividends": [ { "adjusted_dividend_amount": "0.25", "declaration_date": "2024-10-31", "dividend_amount": "0.25", "dividend_yield": "0.44", "ex_date": "2024-11-08", "frequency": "Quarterly", "payment_date": "2024-11-14", "record_date": "2024-11-11" } ], "earnings": [ { "date": "2024-10-31", "eps_actual": "1.64", "eps_estimate": "1.60", "eps_surprise_percent": "2.5", "revenue_actual": "94930000000", "revenue_estimate": "94500000000", "revenue_surprise_percent": "0.45" } ], "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "reporting_currency": "USD", "splits": [ { "date": "2020-08-31", "denominator": "1", "numerator": "4", "split_type": "stock-split" } ] }, "error": null, "metadata": { "request_id": "0f1a2b3c-4d5e-6789-8a7b-6c5d4e3f2a1b" } } ``` ## Get Instrument Fundamentals `InstrumentDataGetInstrumentFundamentalsResponse v1().instrumentData().getInstrumentFundamentals(InstrumentDataGetInstrumentFundamentalsParamsparams = InstrumentDataGetInstrumentFundamentalsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/fundamentals` Retrieves supplemental fundamentals and company profile data for an instrument. ### Parameters - `InstrumentDataGetInstrumentFundamentalsParams params` - `Optional instrumentId` OEMS instrument UUID ### Returns - `class InstrumentDataGetInstrumentFundamentalsResponse:` - `InstrumentFundamentals data` Supplemental fundamentals and company profile data for an instrument. - `Optional averageVolume` The average daily trading volume over the past 30 days - `Optional beta` The beta value, measuring the instrument's volatility relative to the overall market - `Optional description` A detailed description of the instrument or company - `Optional dividendYield` The trailing twelve months (TTM) dividend yield - `Optional earningsPerShare` The trailing twelve months (TTM) earnings per share - `Optional fiftyTwoWeekHigh` The highest price over the last 52 weeks - `Optional fiftyTwoWeekLow` The lowest price over the last 52 weeks - `Optional industry` The specific industry of the instrument's issuer - `Optional listDate` The date the instrument was first listed - `Optional logoUrl` URL to a representative logo image for the instrument or issuer - `Optional marketCap` The total market capitalization - `Optional previousClose` The closing price from the previous trading day - `Optional priceToEarnings` The price-to-earnings (P/E) ratio for the trailing twelve months (TTM) - `Optional reportingCurrency` The currency used for reporting financial data - `Optional sector` The business sector of the instrument's issuer ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentFundamentalsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentFundamentalsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentFundamentalsResponse response = client.v1().instrumentData().getInstrumentFundamentals("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": { "average_volume": 76000000, "beta": "1.20", "description": "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide.", "dividend_yield": "0.005", "earnings_per_share": "5.61", "fifty_two_week_high": "230.00", "fifty_two_week_low": "165.00", "industry": "Consumer Electronics", "list_date": "1980-12-12", "logo_url": "https://example.com/logos/aapl.png", "market_cap": "2800000000000", "previous_close": "210.87", "price_to_earnings": "30.5", "reporting_currency": "USD", "sector": "Technology" }, "error": null, "metadata": { "request_id": "5b6c7d8e-9f0a-1b2c-3d4e-5f6a7b8c9d0e" } } ``` ## Get Instrument Balance Sheet Statements `InstrumentDataGetInstrumentBalanceSheetStatementsResponse v1().instrumentData().getInstrumentBalanceSheetStatements(InstrumentDataGetInstrumentBalanceSheetStatementsParamsparams = InstrumentDataGetInstrumentBalanceSheetStatementsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/balance-sheets` Get balance sheet statements for an instrument. Retrieves quarterly balance sheet statements for a specific instrument, sorted by fiscal period (most recent first). Date range defaults: - `from_date`: None (no lower bound) - `to_date`: None (no upper bound) ### Parameters - `InstrumentDataGetInstrumentBalanceSheetStatementsParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional fromDate` The start date for the query range, inclusive (YYYY-MM-DD). - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional toDate` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `class InstrumentDataGetInstrumentBalanceSheetStatementsResponse:` - `List data` - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional accountPayables` Account payables - `Optional accountsReceivables` Accounts receivables - `Optional accruedExpenses` Accrued expenses - `Optional accumulatedOtherComprehensiveIncomeLoss` Accumulated other comprehensive income/loss - `Optional additionalPaidInCapital` Additional paid-in capital - `Optional capitalLeaseObligations` Capital lease obligations (total) - `Optional capitalLeaseObligationsCurrent` Capital lease obligations (current portion) - `Optional cashAndCashEquivalents` Cash and cash equivalents - `Optional cashAndShortTermInvestments` Cash and short-term investments combined - `Optional commonStock` Common stock - `Optional deferredRevenue` Deferred revenue - `Optional deferredRevenueNonCurrent` Deferred revenue (non-current) - `Optional deferredTaxLiabilitiesNonCurrent` Deferred tax liabilities (non-current) - `Optional goodwill` Goodwill - `Optional goodwillAndIntangibleAssets` Goodwill and intangible assets combined - `Optional intangibleAssets` Intangible assets - `Optional inventory` Inventory - `Optional longTermDebt` Long-term debt - `Optional longTermInvestments` Long-term investments - `Optional minorityInterest` Minority interest - `Optional netDebt` Net debt (total debt minus cash) - `Optional netReceivables` Net receivables - `Optional otherAssets` Other assets - `Optional otherCurrentAssets` Other current assets - `Optional otherCurrentLiabilities` Other current liabilities - `Optional otherLiabilities` Other liabilities - `Optional otherNonCurrentAssets` Other non-current assets - `Optional otherNonCurrentLiabilities` Other non-current liabilities - `Optional otherPayables` Other payables - `Optional otherReceivables` Other receivables - `Optional otherTotalStockholdersEquity` Other total stockholders equity - `Optional preferredStock` Preferred stock - `Optional prepaids` Prepaids - `Optional propertyPlantAndEquipmentNet` Property, plant and equipment net of depreciation - `Optional retainedEarnings` Retained earnings - `Optional shortTermDebt` Short-term debt - `Optional shortTermInvestments` Short-term investments - `Optional taxAssets` Tax assets - `Optional taxPayables` Tax payables - `Optional totalAssets` Total assets - `Optional totalCurrentAssets` Total current assets - `Optional totalCurrentLiabilities` Total current liabilities - `Optional totalDebt` Total debt - `Optional totalEquity` Total equity - `Optional totalInvestments` Total investments - `Optional totalLiabilities` Total liabilities - `Optional totalLiabilitiesAndTotalEquity` Total liabilities and total equity - `Optional totalNonCurrentAssets` Total non-current assets - `Optional totalNonCurrentLiabilities` Total non-current liabilities - `Optional totalPayables` Total payables - `Optional totalStockholdersEquity` Total stockholders equity - `Optional treasuryStock` Treasury stock ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentBalanceSheetStatementsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentBalanceSheetStatementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentBalanceSheetStatementsResponse response = client.v1().instrumentData().getInstrumentBalanceSheetStatements("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": [ { "accepted_date": "2025-05-02T14:30:00Z", "cash_and_cash_equivalents": "29943000000", "filing_date": "2025-05-01", "net_debt": "76323000000", "period": "Q1", "period_type": "QUARTERLY", "reported_currency": "USD", "total_assets": "352583000000", "total_debt": "106266000000", "total_liabilities": "308258000000", "total_stockholders_equity": "56727000000", "year": 2025 } ], "error": null, "metadata": { "next_page_token": "AAAAAAAAAGQAAAAAAAAAZQ==", "page_number": 1, "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "total_items": 20, "total_pages": 2 } } ``` ## Get Instrument Income Statements `InstrumentDataGetInstrumentIncomeStatementsResponse v1().instrumentData().getInstrumentIncomeStatements(InstrumentDataGetInstrumentIncomeStatementsParamsparams = InstrumentDataGetInstrumentIncomeStatementsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/income-statements` Retrieves quarterly income statements for a specific instrument, sorted by fiscal period (most recent first). Date range defaults: - `from_date`: None (no lower bound) - `to_date`: None (no upper bound) ### Parameters - `InstrumentDataGetInstrumentIncomeStatementsParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional fromDate` The start date for the query range, inclusive (YYYY-MM-DD). - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional toDate` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `class InstrumentDataGetInstrumentIncomeStatementsResponse:` - `List data` - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional bottomLineNetIncome` Bottom line net income after all adjustments - `Optional costAndExpenses` Total costs and expenses - `Optional costOfRevenue` Direct costs attributable to producing goods sold - `Optional depreciationAndAmortization` Depreciation and amortization expenses - `Optional ebit` Earnings before interest and taxes - `Optional ebitda` Earnings before interest, taxes, depreciation, and amortization - `Optional eps` Basic earnings per share - `Optional epsDiluted` Diluted earnings per share - `Optional generalAndAdministrativeExpenses` General administrative overhead expenses - `Optional grossProfit` Revenue minus cost of revenue - `Optional incomeBeforeTax` Income before income tax expense - `Optional incomeTaxExpense` Income tax expense for the period - `Optional interestExpense` Interest paid on debt - `Optional interestIncome` Interest earned on investments and cash - `Optional netIncome` Total net income for the period - `Optional netIncomeDeductions` Deductions from net income - `Optional netIncomeFromContinuingOperations` Net income from continuing operations - `Optional netIncomeFromDiscontinuedOperations` Net income from discontinued operations - `Optional netInterestIncome` Net interest income (interest income minus interest expense) - `Optional nonOperatingIncomeExcludingInterest` Non-operating income excluding interest - `Optional operatingExpenses` Total operating expenses - `Optional operatingIncome` Income from core business operations - `Optional otherAdjustmentsToNetIncome` Other adjustments to net income - `Optional otherExpenses` Other miscellaneous expenses - `Optional researchAndDevelopmentExpenses` Expenditure on research and development activities - `Optional revenue` Total revenue from sales of goods and services - `Optional sellingAndMarketingExpenses` Expenditure on marketing and sales activities - `Optional sellingGeneralAndAdministrativeExpenses` Combined selling, general, and administrative expenses - `Optional totalOtherIncomeExpensesNet` Net of other income and expenses - `Optional weightedAverageShsOut` Weighted average shares outstanding (basic) - `Optional weightedAverageShsOutDil` Weighted average shares outstanding (diluted) ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentIncomeStatementsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentIncomeStatementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentIncomeStatementsResponse response = client.v1().instrumentData().getInstrumentIncomeStatements("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": [ { "accepted_date": "2025-05-02T14:30:00Z", "cost_of_revenue": "52080000000", "eps": "1.40", "eps_diluted": "1.38", "filing_date": "2025-05-01", "gross_profit": "42850000000", "net_income": "22200000000", "operating_income": "26550000000", "period": "Q1", "period_type": "QUARTERLY", "reported_currency": "USD", "revenue": "94930000000", "year": 2025 } ], "error": null, "metadata": { "next_page_token": "AAAAAAAAAGQAAAAAAAAAZQ==", "page_number": 1, "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "total_items": 20, "total_pages": 2 } } ``` ## Get Instrument Analyst Consensus `InstrumentDataGetInstrumentAnalystConsensusResponse v1().instrumentData().getInstrumentAnalystConsensus(InstrumentDataGetInstrumentAnalystConsensusParamsparams = InstrumentDataGetInstrumentAnalystConsensusParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/analyst-reporting` Retrieves analyst ratings and price targets for an instrument. ### Parameters - `InstrumentDataGetInstrumentAnalystConsensusParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional from` The start date for the query range, inclusive (YYYY-MM-DD) - `Optional to` The end date for the query range, inclusive (YYYY-MM-DD) ### Returns - `class InstrumentDataGetInstrumentAnalystConsensusResponse:` - `InstrumentAnalystConsensus data` Aggregated analyst consensus metrics - `LocalDate date` The date the consensus snapshot was generated - `Optional distribution` Count of individual analyst recommendations by category - `long buy` Number of buy recommendations - `long hold` Number of hold recommendations - `long sell` Number of sell recommendations - `long strongBuy` Number of strong buy recommendations - `long strongSell` Number of strong sell recommendations - `Optional priceTarget` Aggregated analyst price target statistics - `String average` Average analyst price target - `String currency` ISO 4217 currency code of the price targets - `String high` Highest analyst price target - `String low` Lowest analyst price target - `Optional rating` Consensus analyst rating - `STRONG_BUY("STRONG_BUY")` - `BUY("BUY")` - `HOLD("HOLD")` - `SELL("SELL")` - `STRONG_SELL("STRONG_SELL")` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentAnalystConsensusParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentAnalystConsensusResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentAnalystConsensusResponse response = client.v1().instrumentData().getInstrumentAnalystConsensus("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": { "date": "2025-10-01", "distribution": { "buy": 20, "hold": 3, "sell": 1, "strong_buy": 18, "strong_sell": 0 }, "price_target": { "average": "240.00", "currency": "USD", "high": "275.00", "low": "190.00" }, "rating": "BUY" }, "error": null, "metadata": { "request_id": "9e0f1a2b-3c4d-5e6f-7890-1a2b3c4d5e6f" } } ``` ## Get Instrument Cash Flow Statements `InstrumentDataGetInstrumentCashFlowStatementsResponse v1().instrumentData().getInstrumentCashFlowStatements(InstrumentDataGetInstrumentCashFlowStatementsParamsparams = InstrumentDataGetInstrumentCashFlowStatementsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}/cash-flow-statements` Get cash flow statements for an instrument. Retrieves historical cash flow statements for the specified instrument. Cash flow statements show cash inflows and outflows from operating, investing, and financing activities. ### Parameters - `InstrumentDataGetInstrumentCashFlowStatementsParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional fromDate` The start date for the query range, inclusive (YYYY-MM-DD). - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional toDate` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `class InstrumentDataGetInstrumentCashFlowStatementsResponse:` - `List data` - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional accountsPayables` Change in accounts payables - `Optional accountsReceivables` Change in accounts receivables - `Optional acquisitionsNet` Net acquisitions - `Optional capitalExpenditure` Capital expenditure - `Optional cashAtBeginningOfPeriod` Cash and cash equivalents at beginning of period - `Optional cashAtEndOfPeriod` Cash and cash equivalents at end of period - `Optional changeInWorkingCapital` Change in working capital - `Optional commonDividendsPaid` Common dividends paid - `Optional commonStockIssuance` Common stock issuance - `Optional commonStockRepurchased` Common stock repurchased (buybacks) - `Optional deferredIncomeTax` Deferred income tax expense - `Optional depreciationAndAmortization` Depreciation and amortization expense - `Optional effectOfForexChangesOnCash` Effect of foreign exchange changes on cash - `Optional freeCashFlow` Free cash flow (operating cash flow minus capital expenditure) - `Optional incomeTaxesPaid` Income taxes paid - `Optional interestPaid` Interest paid - `Optional inventory` Change in inventory - `Optional investmentsInPropertyPlantAndEquipment` Investments in property, plant, and equipment - `Optional longTermNetDebtIssuance` Long-term net debt issuance - `Optional netCashProvidedByFinancingActivities` Net cash provided by financing activities - `Optional netCashProvidedByInvestingActivities` Net cash provided by investing activities - `Optional netCashProvidedByOperatingActivities` Net cash provided by operating activities - `Optional netChangeInCash` Net change in cash during the period - `Optional netCommonStockIssuance` Net common stock issuance - `Optional netDebtIssuance` Net debt issuance (long-term + short-term) - `Optional netDividendsPaid` Net dividends paid (common + preferred) - `Optional netIncome` Net income for the period - `Optional netPreferredStockIssuance` Net preferred stock issuance - `Optional netStockIssuance` Net stock issuance (common + preferred) - `Optional operatingCashFlow` Operating cash flow (alternative calculation) - `Optional otherFinancingActivities` Other financing activities - `Optional otherInvestingActivities` Other investing activities - `Optional otherNonCashItems` Other non-cash items - `Optional otherWorkingCapital` Change in other working capital - `Optional preferredDividendsPaid` Preferred dividends paid - `Optional purchasesOfInvestments` Purchases of investments - `Optional salesMaturitiesOfInvestments` Sales and maturities of investments - `Optional shortTermNetDebtIssuance` Short-term net debt issuance - `Optional stockBasedCompensation` Stock-based compensation expense ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentCashFlowStatementsParams; import com.clear_street.api.models.v1.instrumentdata.InstrumentDataGetInstrumentCashFlowStatementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentDataGetInstrumentCashFlowStatementsResponse response = client.v1().instrumentData().getInstrumentCashFlowStatements("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": [ { "accepted_date": "2025-05-02T14:30:00Z", "capital_expenditure": "-2600000000", "cash_at_beginning_of_period": "33743000000", "cash_at_end_of_period": "29943000000", "change_in_working_capital": "-3200000000", "common_stock_repurchased": "-23000000000", "depreciation_and_amortization": "2900000000", "filing_date": "2025-05-01", "free_cash_flow": "25800000000", "investments_in_property_plant_and_equipment": "-2600000000", "net_cash_provided_by_financing_activities": "-28300000000", "net_cash_provided_by_investing_activities": "-3900000000", "net_cash_provided_by_operating_activities": "28400000000", "net_change_in_cash": "-3800000000", "net_debt_issuance": "-1500000000", "net_dividends_paid": "-3800000000", "net_income": "22200000000", "operating_cash_flow": "28400000000", "period": "Q1", "period_type": "QUARTERLY", "purchases_of_investments": "-9500000000", "reported_currency": "USD", "sales_maturities_of_investments": "8200000000", "stock_based_compensation": "2500000000", "year": 2025 } ], "error": null, "metadata": { "next_page_token": "AAAAAAAAAGQAAAAAAAAAZQ==", "page_number": 1, "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "total_items": 20, "total_pages": 2 } } ``` ## Domain Types ### All Events Event Type - `enum AllEventsEventType:` Event types supported by the all-events endpoint. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` ### Analyst Distribution - `class AnalystDistribution:` Analyst recommendation distribution - `long buy` Number of buy recommendations - `long hold` Number of hold recommendations - `long sell` Number of sell recommendations - `long strongBuy` Number of strong buy recommendations - `long strongSell` Number of strong sell recommendations ### Analyst Rating - `enum AnalystRating:` Analyst rating category - `STRONG_BUY("STRONG_BUY")` - `BUY("BUY")` - `HOLD("HOLD")` - `SELL("SELL")` - `STRONG_SELL("STRONG_SELL")` ### Fiscal Period Type - `enum FiscalPeriodType:` Fiscal period type for earnings reports - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` ### Instrument All Events Data - `class InstrumentAllEventsData:` All-events payload grouped by date. - `List eventDates` Events grouped by date in descending order. - `LocalDate date` Event date. - `List events` Flat event envelopes for this date. - `String symbol` Symbol associated with the event. - `AllEventsEventType type` Event type discriminator. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` - `Optional dividendEventData` Dividend payload when type is DIVIDEND. - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `Optional earningsEventData` Earnings payload when type is EARNINGS. - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `Optional instrumentId` OEMS instrument identifier, when the instrument is found in the instrument cache. - `Optional ipoEventData` IPO payload when type is IPO. - `Optional actions` IPO action. - `Optional announcedAt` IPO announced timestamp. - `Optional company` IPO company name. - `Optional exchange` IPO exchange. - `Optional marketCap` IPO market cap. - `Optional priceRange` IPO price range. - `Optional shares` IPO shares offered. - `Optional name` Instrument name associated with the event, when available. - `Optional reportingCurrency` The currency used for reporting financial data. - `Optional stockSplitEventData` Stock split payload when type is STOCK_SPLIT. - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Analyst Consensus - `class InstrumentAnalystConsensus:` Aggregated analyst consensus metrics - `LocalDate date` The date the consensus snapshot was generated - `Optional distribution` Count of individual analyst recommendations by category - `long buy` Number of buy recommendations - `long hold` Number of hold recommendations - `long sell` Number of sell recommendations - `long strongBuy` Number of strong buy recommendations - `long strongSell` Number of strong sell recommendations - `Optional priceTarget` Aggregated analyst price target statistics - `String average` Average analyst price target - `String currency` ISO 4217 currency code of the price targets - `String high` Highest analyst price target - `String low` Lowest analyst price target - `Optional rating` Consensus analyst rating - `STRONG_BUY("STRONG_BUY")` - `BUY("BUY")` - `HOLD("HOLD")` - `SELL("SELL")` - `STRONG_SELL("STRONG_SELL")` ### Instrument Balance Sheet Statement - `class InstrumentBalanceSheetStatement:` A quarterly balance sheet statement for an instrument. - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional accountPayables` Account payables - `Optional accountsReceivables` Accounts receivables - `Optional accruedExpenses` Accrued expenses - `Optional accumulatedOtherComprehensiveIncomeLoss` Accumulated other comprehensive income/loss - `Optional additionalPaidInCapital` Additional paid-in capital - `Optional capitalLeaseObligations` Capital lease obligations (total) - `Optional capitalLeaseObligationsCurrent` Capital lease obligations (current portion) - `Optional cashAndCashEquivalents` Cash and cash equivalents - `Optional cashAndShortTermInvestments` Cash and short-term investments combined - `Optional commonStock` Common stock - `Optional deferredRevenue` Deferred revenue - `Optional deferredRevenueNonCurrent` Deferred revenue (non-current) - `Optional deferredTaxLiabilitiesNonCurrent` Deferred tax liabilities (non-current) - `Optional goodwill` Goodwill - `Optional goodwillAndIntangibleAssets` Goodwill and intangible assets combined - `Optional intangibleAssets` Intangible assets - `Optional inventory` Inventory - `Optional longTermDebt` Long-term debt - `Optional longTermInvestments` Long-term investments - `Optional minorityInterest` Minority interest - `Optional netDebt` Net debt (total debt minus cash) - `Optional netReceivables` Net receivables - `Optional otherAssets` Other assets - `Optional otherCurrentAssets` Other current assets - `Optional otherCurrentLiabilities` Other current liabilities - `Optional otherLiabilities` Other liabilities - `Optional otherNonCurrentAssets` Other non-current assets - `Optional otherNonCurrentLiabilities` Other non-current liabilities - `Optional otherPayables` Other payables - `Optional otherReceivables` Other receivables - `Optional otherTotalStockholdersEquity` Other total stockholders equity - `Optional preferredStock` Preferred stock - `Optional prepaids` Prepaids - `Optional propertyPlantAndEquipmentNet` Property, plant and equipment net of depreciation - `Optional retainedEarnings` Retained earnings - `Optional shortTermDebt` Short-term debt - `Optional shortTermInvestments` Short-term investments - `Optional taxAssets` Tax assets - `Optional taxPayables` Tax payables - `Optional totalAssets` Total assets - `Optional totalCurrentAssets` Total current assets - `Optional totalCurrentLiabilities` Total current liabilities - `Optional totalDebt` Total debt - `Optional totalEquity` Total equity - `Optional totalInvestments` Total investments - `Optional totalLiabilities` Total liabilities - `Optional totalLiabilitiesAndTotalEquity` Total liabilities and total equity - `Optional totalNonCurrentAssets` Total non-current assets - `Optional totalNonCurrentLiabilities` Total non-current liabilities - `Optional totalPayables` Total payables - `Optional totalStockholdersEquity` Total stockholders equity - `Optional treasuryStock` Treasury stock ### Instrument Cash Flow Statement - `class InstrumentCashFlowStatement:` A quarterly cash flow statement for an instrument. - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional accountsPayables` Change in accounts payables - `Optional accountsReceivables` Change in accounts receivables - `Optional acquisitionsNet` Net acquisitions - `Optional capitalExpenditure` Capital expenditure - `Optional cashAtBeginningOfPeriod` Cash and cash equivalents at beginning of period - `Optional cashAtEndOfPeriod` Cash and cash equivalents at end of period - `Optional changeInWorkingCapital` Change in working capital - `Optional commonDividendsPaid` Common dividends paid - `Optional commonStockIssuance` Common stock issuance - `Optional commonStockRepurchased` Common stock repurchased (buybacks) - `Optional deferredIncomeTax` Deferred income tax expense - `Optional depreciationAndAmortization` Depreciation and amortization expense - `Optional effectOfForexChangesOnCash` Effect of foreign exchange changes on cash - `Optional freeCashFlow` Free cash flow (operating cash flow minus capital expenditure) - `Optional incomeTaxesPaid` Income taxes paid - `Optional interestPaid` Interest paid - `Optional inventory` Change in inventory - `Optional investmentsInPropertyPlantAndEquipment` Investments in property, plant, and equipment - `Optional longTermNetDebtIssuance` Long-term net debt issuance - `Optional netCashProvidedByFinancingActivities` Net cash provided by financing activities - `Optional netCashProvidedByInvestingActivities` Net cash provided by investing activities - `Optional netCashProvidedByOperatingActivities` Net cash provided by operating activities - `Optional netChangeInCash` Net change in cash during the period - `Optional netCommonStockIssuance` Net common stock issuance - `Optional netDebtIssuance` Net debt issuance (long-term + short-term) - `Optional netDividendsPaid` Net dividends paid (common + preferred) - `Optional netIncome` Net income for the period - `Optional netPreferredStockIssuance` Net preferred stock issuance - `Optional netStockIssuance` Net stock issuance (common + preferred) - `Optional operatingCashFlow` Operating cash flow (alternative calculation) - `Optional otherFinancingActivities` Other financing activities - `Optional otherInvestingActivities` Other investing activities - `Optional otherNonCashItems` Other non-cash items - `Optional otherWorkingCapital` Change in other working capital - `Optional preferredDividendsPaid` Preferred dividends paid - `Optional purchasesOfInvestments` Purchases of investments - `Optional salesMaturitiesOfInvestments` Sales and maturities of investments - `Optional shortTermNetDebtIssuance` Short-term net debt issuance - `Optional stockBasedCompensation` Stock-based compensation expense ### Instrument Dividend Event - `class InstrumentDividendEvent:` Represents a dividend event for an instrument - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. ### Instrument Earnings - `class InstrumentEarnings:` Represents instrument earnings data - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue ### Instrument Event Envelope - `class InstrumentEventEnvelope:` Unified envelope for the all-events response. - `String symbol` Symbol associated with the event. - `AllEventsEventType type` Event type discriminator. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` - `Optional dividendEventData` Dividend payload when type is DIVIDEND. - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `Optional earningsEventData` Earnings payload when type is EARNINGS. - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `Optional instrumentId` OEMS instrument identifier, when the instrument is found in the instrument cache. - `Optional ipoEventData` IPO payload when type is IPO. - `Optional actions` IPO action. - `Optional announcedAt` IPO announced timestamp. - `Optional company` IPO company name. - `Optional exchange` IPO exchange. - `Optional marketCap` IPO market cap. - `Optional priceRange` IPO price range. - `Optional shares` IPO shares offered. - `Optional name` Instrument name associated with the event, when available. - `Optional reportingCurrency` The currency used for reporting financial data. - `Optional stockSplitEventData` Stock split payload when type is STOCK_SPLIT. - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Event Ipo Item - `class InstrumentEventIpoItem:` IPO event in the all-events date grouping response. - `Optional actions` IPO action. - `Optional announcedAt` IPO announced timestamp. - `Optional company` IPO company name. - `Optional exchange` IPO exchange. - `Optional marketCap` IPO market cap. - `Optional priceRange` IPO price range. - `Optional shares` IPO shares offered. ### Instrument Events By Date - `class InstrumentEventsByDate:` Instrument events for a single date. - `LocalDate date` Event date. - `List events` Flat event envelopes for this date. - `String symbol` Symbol associated with the event. - `AllEventsEventType type` Event type discriminator. - `EARNINGS("EARNINGS")` - `DIVIDEND("DIVIDEND")` - `STOCK_SPLIT("STOCK_SPLIT")` - `IPO("IPO")` - `Optional dividendEventData` Dividend payload when type is DIVIDEND. - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `Optional earningsEventData` Earnings payload when type is EARNINGS. - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `Optional instrumentId` OEMS instrument identifier, when the instrument is found in the instrument cache. - `Optional ipoEventData` IPO payload when type is IPO. - `Optional actions` IPO action. - `Optional announcedAt` IPO announced timestamp. - `Optional company` IPO company name. - `Optional exchange` IPO exchange. - `Optional marketCap` IPO market cap. - `Optional priceRange` IPO price range. - `Optional shares` IPO shares offered. - `Optional name` Instrument name associated with the event, when available. - `Optional reportingCurrency` The currency used for reporting financial data. - `Optional stockSplitEventData` Stock split payload when type is STOCK_SPLIT. - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Events Data - `class InstrumentEventsData:` Grouped instrument events by type - `List dividends` Dividend distribution events - `String adjustedDividendAmount` The adjusted dividend amount accounting for any splits. - `LocalDate exDate` The day the stock starts trading without the right to receive that dividend. - `Optional declarationDate` The declaration date of the dividend - `Optional dividendAmount` The dividend amount per share. - `Optional dividendYield` The dividend yield as a percentage of the stock price. - `Optional frequency` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `Optional paymentDate` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `Optional recordDate` The record date, set by a company's board of directors, is when a company compiles a list of shareholders of the stock for which it has declared a dividend. - `List earnings` Earnings announcement events - `LocalDate date` The date when the earnings report was published - `Optional epsActual` The actual earnings per share (EPS) for the period - `Optional epsEstimate` The estimated earnings per share (EPS) for the period - `Optional epsSurprisePercent` The percentage difference between actual and estimated EPS - `Optional revenueActual` The actual total revenue for the period - `Optional revenueEstimate` The estimated total revenue for the period - `Optional revenueSurprisePercent` The percentage difference between actual and estimated revenue - `String instrumentId` OEMS instrument UUID from the request - `List splits` Stock split events - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") - `Optional reportingCurrency` The currency used for reporting financial data ### Instrument Fundamentals - `class InstrumentFundamentals:` Supplemental fundamentals and company profile data for an instrument. - `Optional averageVolume` The average daily trading volume over the past 30 days - `Optional beta` The beta value, measuring the instrument's volatility relative to the overall market - `Optional description` A detailed description of the instrument or company - `Optional dividendYield` The trailing twelve months (TTM) dividend yield - `Optional earningsPerShare` The trailing twelve months (TTM) earnings per share - `Optional fiftyTwoWeekHigh` The highest price over the last 52 weeks - `Optional fiftyTwoWeekLow` The lowest price over the last 52 weeks - `Optional industry` The specific industry of the instrument's issuer - `Optional listDate` The date the instrument was first listed - `Optional logoUrl` URL to a representative logo image for the instrument or issuer - `Optional marketCap` The total market capitalization - `Optional previousClose` The closing price from the previous trading day - `Optional priceToEarnings` The price-to-earnings (P/E) ratio for the trailing twelve months (TTM) - `Optional reportingCurrency` The currency used for reporting financial data - `Optional sector` The business sector of the instrument's issuer ### Instrument Income Statement - `class InstrumentIncomeStatement:` A quarterly income statement for an instrument. - `LocalDateTime acceptedDate` The date and time when the filing was accepted by the SEC - `LocalDate filingDate` The date the financial statement was filed - `String period` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `FiscalPeriodType periodType` The type of fiscal period - `QUARTERLY("QUARTERLY")` - `ANNUAL("ANNUAL")` - `TTM("TTM")` - `BIANNUAL("BIANNUAL")` - `String reportedCurrency` The currency in which the statement is reported (ISO 4217) - `long year` The fiscal year of the statement - `Optional bottomLineNetIncome` Bottom line net income after all adjustments - `Optional costAndExpenses` Total costs and expenses - `Optional costOfRevenue` Direct costs attributable to producing goods sold - `Optional depreciationAndAmortization` Depreciation and amortization expenses - `Optional ebit` Earnings before interest and taxes - `Optional ebitda` Earnings before interest, taxes, depreciation, and amortization - `Optional eps` Basic earnings per share - `Optional epsDiluted` Diluted earnings per share - `Optional generalAndAdministrativeExpenses` General administrative overhead expenses - `Optional grossProfit` Revenue minus cost of revenue - `Optional incomeBeforeTax` Income before income tax expense - `Optional incomeTaxExpense` Income tax expense for the period - `Optional interestExpense` Interest paid on debt - `Optional interestIncome` Interest earned on investments and cash - `Optional netIncome` Total net income for the period - `Optional netIncomeDeductions` Deductions from net income - `Optional netIncomeFromContinuingOperations` Net income from continuing operations - `Optional netIncomeFromDiscontinuedOperations` Net income from discontinued operations - `Optional netInterestIncome` Net interest income (interest income minus interest expense) - `Optional nonOperatingIncomeExcludingInterest` Non-operating income excluding interest - `Optional operatingExpenses` Total operating expenses - `Optional operatingIncome` Income from core business operations - `Optional otherAdjustmentsToNetIncome` Other adjustments to net income - `Optional otherExpenses` Other miscellaneous expenses - `Optional researchAndDevelopmentExpenses` Expenditure on research and development activities - `Optional revenue` Total revenue from sales of goods and services - `Optional sellingAndMarketingExpenses` Expenditure on marketing and sales activities - `Optional sellingGeneralAndAdministrativeExpenses` Combined selling, general, and administrative expenses - `Optional totalOtherIncomeExpensesNet` Net of other income and expenses - `Optional weightedAverageShsOut` Weighted average shares outstanding (basic) - `Optional weightedAverageShsOutDil` Weighted average shares outstanding (diluted) ### Instrument Split Event - `class InstrumentSplitEvent:` Represents a stock split event for an instrument - `LocalDate date` The date of the stock split - `String denominator` The denominator of the split ratio - `String numerator` The numerator of the split ratio - `String splitType` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Price Target - `class PriceTarget:` Analyst price target statistics - `String average` Average analyst price target - `String currency` ISO 4217 currency code of the price targets - `String high` Highest analyst price target - `String low` Lowest analyst price target # Market Data ## Get Snapshots `MarketDataGetSnapshotsResponse v1().instrumentData().marketData().getSnapshots(MarketDataGetSnapshotsParamsparams = MarketDataGetSnapshotsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/market-data/snapshot` Get market data snapshots for one or more securities. ### Parameters - `MarketDataGetSnapshotsParams params` - `Optional> instrumentIds` Comma-separated OEMS instrument UUIDs. ### Returns - `class MarketDataGetSnapshotsResponse:` - `List data` - `String instrumentId` OEMS instrument identifier. - `String symbol` Display symbol for the security. - `Optional cumulativeVolume` Cumulative traded volume reported on the most recent trade, in shares for equities or contracts for options. Absent when no trade is available. - `Optional lastQuote` Most recent quote if available. - `String ask` Current best ask. - `String bid` Current best bid. - `String midpoint` Midpoint of bid and ask. - `Optional askSize` Size at the best ask, in shares. - `Optional bidSize` Size at the best bid, in shares. - `Optional lastTrade` Most recent last-sale trade if available. - `String price` Most recent last-sale eligible trade price. - `Optional name` Security name if available. - `Optional session` Session metrics computed from previous close and last trade, if available. - `String change` Absolute change from previous close to last trade. - `String changePercent` Percent change from previous close to last trade. - `String previousClose` Previous session close price. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.marketdata.MarketDataGetSnapshotsParams; import com.clear_street.api.models.v1.instrumentdata.marketdata.MarketDataGetSnapshotsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); MarketDataGetSnapshotsResponse response = client.v1().instrumentData().marketData().getSnapshots(); } } ``` #### Response ```json { "data": [ { "cumulative_volume": 12345678, "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "last_quote": { "ask": "210.14", "ask_size": 120, "bid": "210.10", "bid_size": 100, "midpoint": "210.12" }, "last_trade": { "price": "210.12" }, "name": "Apple Inc.", "session": { "change": "1.82", "change_percent": "0.8737", "previous_close": "208.30" }, "symbol": "AAPL" } ], "error": null, "metadata": { "request_id": "2d0c9159-8f5d-49ca-a861-0d8346fd11da" } } ``` ## Get Daily Aggregate Summaries `MarketDataGetDailySummariesResponse v1().instrumentData().marketData().getDailySummaries(MarketDataGetDailySummariesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/market-data/daily-summary` Returns the most recent OHLV and current price for the requested OEMS instruments. Backed by the in-memory Polygon snapshot cache. Response contract: every request returns one row per **unique** `instrument_id`, in first-seen request order. Unresolvable IDs come back with `symbol = null` and every market-data field `null`; resolvable IDs with no cache entry come back with `symbol` populated but market-data fields `null`. **Note (temporary):** ID resolution currently goes through the supplemental screener (OEMS instrument_id → FMP fmp_symbol → metadata_id → realtime cache). Removed when the market-data service serves daily aggregates directly, or when Polygon symbology is loaded into the instrument cache. ### Parameters - `MarketDataGetDailySummariesParams params` - `String instrumentIds` Comma-separated OEMS instrument UUIDs (required, 1..=100) ### Returns - `class MarketDataGetDailySummariesResponse:` - `List data` - `String instrumentId` OEMS instrument identifier. Always populated; echoes the request ID. - `Optional high` Session high. - `Optional low` Session low. - `Optional open` Opening price for the session. - `Optional symbol` Display symbol for the security. `None` for unresolvable IDs. - `Optional tradeDate` Session date the OHLV represents, US/Eastern. - `Optional volume` Session cumulative trading volume. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.marketdata.MarketDataGetDailySummariesParams; import com.clear_street.api.models.v1.instrumentdata.marketdata.MarketDataGetDailySummariesResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); MarketDataGetDailySummariesParams params = MarketDataGetDailySummariesParams.builder() .instrumentIds("instrument_ids") .build(); MarketDataGetDailySummariesResponse response = client.v1().instrumentData().marketData().getDailySummaries(params); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": [ { "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "high": "215.20", "low": "210.10", "open": "211.00", "symbol": "AAPL", "trade_date": "2026-04-23", "volume": 88000000 } ] } ``` ## Domain Types ### Daily Summary - `class DailySummary:` Daily aggregate (OHLV) summary for a single instrument. Returned by `GET /market-data/daily-summary`. Every field except `instrument_id` is `Option`: - Unresolvable `instrument_id` → all other fields `None` (including `symbol`). - Resolvable `instrument_id` with no realtime cache entry → `symbol` populated, OHLV/`trade_date` `None`. - `trade_date` reflects the session the OHLV represents (today during trading hours, the last trading date during weekends/holidays). - `String instrumentId` OEMS instrument identifier. Always populated; echoes the request ID. - `Optional high` Session high. - `Optional low` Session low. - `Optional open` Opening price for the session. - `Optional symbol` Display symbol for the security. `None` for unresolvable IDs. - `Optional tradeDate` Session date the OHLV represents, US/Eastern. - `Optional volume` Session cumulative trading volume. ### Market Data Snapshot - `class MarketDataSnapshot:` Market data snapshot for a single security. - `String instrumentId` OEMS instrument identifier. - `String symbol` Display symbol for the security. - `Optional cumulativeVolume` Cumulative traded volume reported on the most recent trade, in shares for equities or contracts for options. Absent when no trade is available. - `Optional lastQuote` Most recent quote if available. - `String ask` Current best ask. - `String bid` Current best bid. - `String midpoint` Midpoint of bid and ask. - `Optional askSize` Size at the best ask, in shares. - `Optional bidSize` Size at the best bid, in shares. - `Optional lastTrade` Most recent last-sale trade if available. - `String price` Most recent last-sale eligible trade price. - `Optional name` Security name if available. - `Optional session` Session metrics computed from previous close and last trade, if available. - `String change` Absolute change from previous close to last trade. - `String changePercent` Percent change from previous close to last trade. - `String previousClose` Previous session close price. ### Snapshot Last Trade - `class SnapshotLastTrade:` Last-trade fields for a market data snapshot. - `String price` Most recent last-sale eligible trade price. ### Snapshot Quote - `class SnapshotQuote:` L1 quote fields for a market data snapshot. - `String ask` Current best ask. - `String bid` Current best bid. - `String midpoint` Midpoint of bid and ask. - `Optional askSize` Size at the best ask, in shares. - `Optional bidSize` Size at the best bid, in shares. ### Snapshot Session - `class SnapshotSession:` Session-level pricing metrics for a market data snapshot. - `String change` Absolute change from previous close to last trade. - `String changePercent` Percent change from previous close to last trade. - `String previousClose` Previous session close price. # News ## Get News `NewsGetNewsResponse v1().instrumentData().news().getNews(NewsGetNewsParamsparams = NewsGetNewsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/news` Retrieves news items with optional filtering by security IDs, time range, publisher, type, and text query. ### Parameters - `NewsGetNewsParams params` - `Optional excludePublishers` Comma-separated list of publishers to exclude (mutually exclusive with include_publishers). - `Optional from` Inclusive start timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime. - `Optional includePublishers` Comma-separated list of publishers to include (mutually exclusive with exclude_publishers). - `Optional> instrumentIds` Comma-delimited OEMS instrument UUIDs to filter by. - `Optional newsType` Filter by news type. - `NEWS("NEWS")` - `PRESS_RELEASE("PRESS_RELEASE")` - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional searchQuery` Free-text query matched against title/text and associated security IDs. - `Optional> sectors` Comma-separated sector values to filter by. - `BASIC_MATERIALS("BASIC_MATERIALS")` - `COMMUNICATION_SERVICES("COMMUNICATION_SERVICES")` - `CONSUMER_CYCLICAL("CONSUMER_CYCLICAL")` - `CONSUMER_DEFENSIVE("CONSUMER_DEFENSIVE")` - `ENERGY("ENERGY")` - `FINANCIAL_SERVICES("FINANCIAL_SERVICES")` - `HEALTHCARE("HEALTHCARE")` - `INDUSTRIALS("INDUSTRIALS")` - `REAL_ESTATE("REAL_ESTATE")` - `TECHNOLOGY("TECHNOLOGY")` - `UTILITIES("UTILITIES")` - `Optional to` Inclusive end timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime. ### Returns - `class NewsGetNewsResponse:` - `List data` - `List instruments` Instruments associated with this news item. - `String instrumentId` OEMS instrument UUID. - `Optional name` Instrument name/description, if available from instrument cache enrichment. - `Optional symbol` Trading symbol, if available from instrument cache enrichment. - `NewsType newsType` Classification of the item. - `NEWS("NEWS")` - `PRESS_RELEASE("PRESS_RELEASE")` - `LocalDateTime publishedAt` The published date/time of the article in UTC. - `String publisher` The publisher or newswire source. - `String title` The headline/title of the article. - `String url` Canonical URL to the full article. - `Optional imageUrl` URL of an associated image if provided by the source. - `Optional site` The primary domain/site of the publisher. - `Optional text` The full or excerpted article body. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instrumentdata.news.NewsGetNewsParams; import com.clear_street.api.models.v1.instrumentdata.news.NewsGetNewsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); NewsGetNewsResponse response = client.v1().instrumentData().news().getNews(); } } ``` #### Response ```json { "data": [ { "instruments": [ { "instrument_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "name": "Apple Inc.", "symbol": "AAPL" } ], "news_type": "NEWS", "published_at": "2025-10-31T14:30:00.000000000Z", "publisher": "Reuters", "site": "reuters.com", "title": "Apple announces new hardware lineup", "url": "https://example.com/news/1" } ], "error": null, "metadata": { "next_page_token": "cGFnZT0yJmxhc3Rfc3ltYm9sPVRTM0E", "page_number": 1, "request_id": "0f1a2b3c-4d5e-6f78-9012-3a4b5c6d7e8f", "total_items": 25, "total_pages": 3 } } ``` ## Domain Types ### News Instrument - `class NewsInstrument:` Instrument associated with a news item. - `String instrumentId` OEMS instrument UUID. - `Optional name` Instrument name/description, if available from instrument cache enrichment. - `Optional symbol` Trading symbol, if available from instrument cache enrichment. ### News Item - `class NewsItem:` A single news item and its associated instruments. - `List instruments` Instruments associated with this news item. - `String instrumentId` OEMS instrument UUID. - `Optional name` Instrument name/description, if available from instrument cache enrichment. - `Optional symbol` Trading symbol, if available from instrument cache enrichment. - `NewsType newsType` Classification of the item. - `NEWS("NEWS")` - `PRESS_RELEASE("PRESS_RELEASE")` - `LocalDateTime publishedAt` The published date/time of the article in UTC. - `String publisher` The publisher or newswire source. - `String title` The headline/title of the article. - `String url` Canonical URL to the full article. - `Optional imageUrl` URL of an associated image if provided by the source. - `Optional site` The primary domain/site of the publisher. - `Optional text` The full or excerpted article body. ### News Type - `enum NewsType:` News item classification. - `NEWS("NEWS")` - `PRESS_RELEASE("PRESS_RELEASE")` # Instruments ## Get Instruments `InstrumentGetInstrumentsResponse v1().instruments().getInstruments(InstrumentGetInstrumentsParamsparams = InstrumentGetInstrumentsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments` Retrieves a list of tradeable instruments. ### Parameters - `InstrumentGetInstrumentsParams params` - `Optional easyToBorrow` Filter by easy to borrow status - `Optional> instrumentIds` Comma-separated OEMS instrument UUIDs - `Optional instrumentType` Filter by instrument type. OPTION is not supported on this endpoint; use GET /instruments/options/contracts to list option contracts. If omitted, returns all supported instrument types except options. - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional isLiquidationOnly` Filter by liquidation only status - `Optional isMarginable` Filter by marginable status - `Optional isRestricted` Filter by restricted status - `Optional isShortProhibited` Filter by short prohibited status - `Optional isThresholdSecurity` Filter by threshold security status - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class InstrumentGetInstrumentsResponse:` - `List data` - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instruments.InstrumentGetInstrumentsParams; import com.clear_street.api.models.v1.instruments.InstrumentGetInstrumentsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentGetInstrumentsResponse response = client.v1().instruments().getInstruments(); } } ``` #### Response ```json { "data": [ { "country_of_issue": "US", "currency": "USD", "easy_to_borrow": true, "id": "0f5a1a4e-5b3e-4d8f-9b7a-2b1d0e3f4a5b", "instrument_type": "COMMON_STOCK", "is_liquidation_only": false, "is_marginable": true, "is_restricted": false, "is_short_prohibited": false, "is_threshold_security": false, "is_tradable": true, "name": "Apple Inc.", "symbol": "AAPL", "venue": "XNMS" } ], "error": null, "metadata": { "next_page_token": "cGFnZT0yJmxhc3Rfc3ltYm9sPUdNRQ==", "page_number": 1, "request_id": "4a5b6c7d-8e9f-0a1b-2c3d-4e5f6a7b8c9d", "total_items": 10, "total_pages": 5 } } ``` ## Get Instrument By ID `InstrumentGetInstrumentByIdResponse v1().instruments().getInstrumentById(InstrumentGetInstrumentByIdParamsparams = InstrumentGetInstrumentByIdParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/{instrument_id}` Retrieves detailed information for a specific instrument. ### Parameters - `InstrumentGetInstrumentByIdParams params` - `Optional instrumentId` OEMS instrument UUID - `Optional includeOptionsExpiryDates` When true, include unique options expiry dates for this instrument ### Returns - `class InstrumentGetInstrumentByIdResponse:` - `Instrument data` Represents a tradable financial instrument. - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional> optionsExpiryDates` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instruments.InstrumentGetInstrumentByIdParams; import com.clear_street.api.models.v1.instruments.InstrumentGetInstrumentByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentGetInstrumentByIdResponse response = client.v1().instruments().getInstrumentById("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"); } } ``` #### Response ```json { "data": { "country_of_issue": "US", "currency": "USD", "easy_to_borrow": true, "id": "0f5a1a4e-5b3e-4d8f-9b7a-2b1d0e3f4a5b", "instrument_type": "COMMON_STOCK", "is_liquidation_only": false, "is_marginable": true, "is_restricted": false, "is_short_prohibited": false, "is_threshold_security": false, "is_tradable": true, "long_margin_rate": "0.25", "name": "Apple Inc.", "short_margin_rate": "0.25", "symbol": "AAPL", "venue": "XNMS" }, "error": null, "metadata": { "request_id": "5b6c7d8e-9f0a-1b2c-3d4e-5f6a7b8c9d0e" } } ``` ## Search Instruments `InstrumentSearchInstrumentsResponse v1().instruments().searchInstruments(InstrumentSearchInstrumentsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/search` Search instruments by symbol, alternate identifier, or company name. The `q` parameter is case-insensitive and supports ticker symbols, alternate identifiers such as CUSIP, ISIN, OPRA root, and CMS identifiers, and company names for non-option instruments. Results are ranked by match quality plus instrument quality signals including log-scaled ADV, listing status, marginability, easy-to-borrow status, and OTC, restricted, and liquidation-only penalties. Defaults to the `EQUITY` asset class (common stocks, preferred shares, ADRs, ETFs, and exchange-traded mutual funds). Pass `asset_class=OPTION` to search option contracts by symbol or alternate identifier. ### Parameters - `InstrumentSearchInstrumentsParams params` - `String q` Search term applied case-insensitively to ticker symbols, alternate identifiers (CUSIP, ISIN, OPRA root, CMS), and company names for non-option instruments. Option searches match symbols and alternate identifiers. - `Optional assetClass` Comma-separated asset classes (EQUITY|OPTION|WARRANT|BOND|FX|OTHER). Defaults to EQUITY. - `Optional country` Optional listing-country filter (e.g., US). - `Optional currency` Optional ISO currency filter (e.g., USD). - `Optional includeInactive` Include inactive instruments. Default false. - `Optional includeRestricted` Include restricted instruments. Default true (penalized in ranking). - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class InstrumentSearchInstrumentsResponse:` - `List data` - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instruments.InstrumentSearchInstrumentsParams; import com.clear_street.api.models.v1.instruments.InstrumentSearchInstrumentsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentSearchInstrumentsParams params = InstrumentSearchInstrumentsParams.builder() .q("q") .build(); InstrumentSearchInstrumentsResponse response = client.v1().instruments().searchInstruments(params); } } ``` #### Response ```json { "data": [ { "currency": "USD", "id": "0f5a1a4e-5b3e-4d8f-9b7a-2b1d0e3f4a5b", "instrument_type": "COMMON_STOCK", "is_marginable": true, "name": "Apple Inc.", "symbol": "AAPL", "venue": "XNMS" } ], "error": null, "metadata": { "request_id": "..." } } ``` ## Get Option Contracts `InstrumentGetOptionContractsResponse v1().instruments().getOptionContracts(InstrumentGetOptionContractsParamsparams = InstrumentGetOptionContractsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/instruments/options/contracts` List options contracts. Returns options contracts for a given underlier with options-specific metadata. Exactly one underlier identifier must be provided. ### Parameters - `InstrumentGetOptionContractsParams params` - `Optional contractType` Filter by contract type: CALL or PUT - `Optional expiry` Filter to contracts expiring on this date (YYYY-MM-DD) - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional underlier` Underlier symbol (e.g., AAPL, SPX) - `Optional underlyingInstrumentId` OEMS instrument UUID or symbol of the underlying equity/index ### Returns - `class InstrumentGetOptionContractsResponse:` - `List data` - `String id` OEMS instrument identifier - `ContractType contractType` Whether this is a CALL or PUT - `CALL("CALL")` - `PUT("PUT")` - `String currency` ISO currency code - `String exchange` MIC code of the primary listing venue - `ExerciseStyle exerciseStyle` Exercise style - `AMERICAN("AMERICAN")` - `EUROPEAN("EUROPEAN")` - `LocalDate expiry` Expiration date - `boolean isLiquidationOnly` Whether the contract is liquidation-only - `boolean isMarginable` Whether the contract is marginable - `boolean isRestricted` Whether the contract is restricted from trading - `ListingType listingType` Listing type - `STANDARD("STANDARD")` - `FLEX("FLEX")` - `OTC("OTC")` - `String multiplier` Contract multiplier (100 for standard options) - `String strikePrice` Strike price - `String symbol` OSI symbol (e.g. "AAPL 251219C00150000") - `Optional openInterest` Open interest (number of outstanding contracts), if available - `Optional underlyingInstrumentId` OEMS instrument ID of the underlying instrument, if resolvable ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.instruments.InstrumentGetOptionContractsParams; import com.clear_street.api.models.v1.instruments.InstrumentGetOptionContractsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); InstrumentGetOptionContractsResponse response = client.v1().instruments().getOptionContracts(); } } ``` #### Response ```json { "data": [ { "contract_type": "CALL", "currency": "USD", "exchange": "BATO", "exercise_style": "AMERICAN", "expiry": "2026-03-20", "id": "b6f4b5e2-94a8-4fe4-9a85-2b4a81d30cc5", "is_liquidation_only": false, "is_marginable": true, "is_restricted": false, "is_tradable": true, "listing_type": "STANDARD", "multiplier": "100", "strike_price": "180", "symbol": "AAPL 260320C00180000", "underlying_instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" }, { "contract_type": "PUT", "currency": "USD", "exchange": "BATO", "exercise_style": "AMERICAN", "expiry": "2026-03-20", "id": "c7e5c6f3-a5b9-5gf5-0b96-3c5b92e41dd6", "is_liquidation_only": false, "is_marginable": true, "is_restricted": false, "is_tradable": true, "listing_type": "STANDARD", "multiplier": "100", "strike_price": "180", "symbol": "AAPL 260320P00180000", "underlying_instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" } ], "metadata": { "page_number": 1, "request_id": "c2d0429d-c629-4ee1-b719-df007157f3bb", "total_items": 2, "total_pages": 1 } } ``` ## Domain Types ### Contract Type - `enum ContractType:` The type of options contract - `CALL("CALL")` - `PUT("PUT")` ### Exercise Style - `enum ExerciseStyle:` The exercise style of an options contract - `AMERICAN("AMERICAN")` - `EUROPEAN("EUROPEAN")` ### Instrument - `class Instrument:` Represents a tradable financial instrument. - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional> optionsExpiryDates` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments ### Instrument Core - `class InstrumentCore:` - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments ### Listing Type - `enum ListingType:` The listing type of an options contract - `STANDARD("STANDARD")` - `FLEX("FLEX")` - `OTC("OTC")` ### Options Contract - `class OptionsContract:` An options contract with options-specific metadata - `String id` OEMS instrument identifier - `ContractType contractType` Whether this is a CALL or PUT - `CALL("CALL")` - `PUT("PUT")` - `String currency` ISO currency code - `String exchange` MIC code of the primary listing venue - `ExerciseStyle exerciseStyle` Exercise style - `AMERICAN("AMERICAN")` - `EUROPEAN("EUROPEAN")` - `LocalDate expiry` Expiration date - `boolean isLiquidationOnly` Whether the contract is liquidation-only - `boolean isMarginable` Whether the contract is marginable - `boolean isRestricted` Whether the contract is restricted from trading - `ListingType listingType` Listing type - `STANDARD("STANDARD")` - `FLEX("FLEX")` - `OTC("OTC")` - `String multiplier` Contract multiplier (100 for standard options) - `String strikePrice` Strike price - `String symbol` OSI symbol (e.g. "AAPL 251219C00150000") - `Optional openInterest` Open interest (number of outstanding contracts), if available - `Optional underlyingInstrumentId` OEMS instrument ID of the underlying instrument, if resolvable # Omni AI ## Domain Types ### Action Button - `class ActionButton:` Button metadata shared by chart and suggested-actions payloads. - `String buttonId` Stable button identifier within the content part. - `String label` User-visible label. - `Optional prompt` Follow-up prompt to submit as the next user message. - `String prompt` Prompt text to submit as the next user turn. - `Optional structuredAction` Structured action in the same message to execute on click. - `Optional actionId` UUID of a `structured_action` content part in the same message. ### Chart Payload - `class ChartPayload:` Typed chart payload rendered inline in assistant content. - `String chartId` Stable chart identifier scoped to the content part. - `Optional> actionButtons` Buttons associated with this chart. - `String buttonId` Stable button identifier within the content part. - `String label` User-visible label. - `Optional prompt` Follow-up prompt to submit as the next user message. - `String prompt` Prompt text to submit as the next user turn. - `Optional structuredAction` Structured action in the same message to execute on click. - `Optional actionId` UUID of a `structured_action` content part in the same message. - `Optional dataChart` Explicit series-driven chart definition. - `Optional> series` - `String name` - `Optional> points` - `String x` - `double y` - `Optional symbolChart` Symbol-driven chart definition. - `String symbol` - `Optional timeframe` ### Chart Point - `class ChartPoint:` Single chart coordinate. - `String x` - `double y` ### Chart Series - `class ChartSeries:` Named data series within a chart. - `String name` - `Optional> points` - `String x` - `double y` ### Content Part Chart Payload - `class ContentPartChartPayload:` Chart payload content part. - `ChartPayload payload` Typed chart payload rendered inline in assistant content. - `String chartId` Stable chart identifier scoped to the content part. - `Optional> actionButtons` Buttons associated with this chart. - `String buttonId` Stable button identifier within the content part. - `String label` User-visible label. - `Optional prompt` Follow-up prompt to submit as the next user message. - `String prompt` Prompt text to submit as the next user turn. - `Optional structuredAction` Structured action in the same message to execute on click. - `Optional actionId` UUID of a `structured_action` content part in the same message. - `Optional dataChart` Explicit series-driven chart definition. - `Optional> series` - `String name` - `Optional> points` - `String x` - `double y` - `Optional symbolChart` Symbol-driven chart definition. - `String symbol` - `Optional timeframe` ### Content Part Custom Payload - `class ContentPartCustomPayload:` Escape-hatch custom payload content part. - `JsonValue payload` ### Content Part Structured Action Payload - `class ContentPartStructuredActionPayload:` Structured action content part. - `StructuredAction action` Structured actions that Omni AI can return to clients. These actions provide machine-readable instructions for the client to execute, such as prefilling an order ticket, opening a chart, or navigating to a route. - `PrefillOrder` - `PrefillOrderAction prefillOrder` Prefill an order ticket for user confirmation - `PrefillNewOrderAction` - `ActionType actionType` - `NEW("NEW")` - `PrefillCancelOrderAction` - `ActionType actionType` - `CANCEL("CANCEL")` - `OpenChart` - `OpenChartAction openChart` Open a chart for a symbol - `String symbol` Trading symbol to chart - `Optional extras` Additional chart configuration (indicators, overlays, etc.) - `Optional timeframe` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") - `OpenScreener` - `OpenScreenerAction openScreener` Open a stock screener with filters - `List filters` Filter criteria for the screener - `String field` Field to filter on (e.g., "market_cap", "sector", "price") - `String operator` Comparison operator (e.g., "eq", "gte", "lte", "in") - `JsonValue value` Filter value - `Optional> fieldFilter` Optional field/column selection for screener results. - `Optional pageSize` Optional page size. - `Optional sortBy` Optional sort field for screener rows. - `Optional sortDirection` Optional sort direction (`ASC` or `DESC`). - `OpenEntitlementConsent` - `OpenEntitlementConsentAction openEntitlementConsent` Open entitlement consent flow - `EntitlementAgreementKey agreementKey` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` - `String reason` - `List requestedEntitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `List tradingAccountIds` - `String actionId` ### Content Part Suggested Actions Payload - `class ContentPartSuggestedActionsPayload:` Suggested actions payload content part. - `SuggestedActionsPayload payload` Suggested follow-up buttons rendered at the end of an assistant message. - `Optional> actionButtons` Ordered message-level buttons. - `String buttonId` Stable button identifier within the content part. - `String label` User-visible label. - `Optional prompt` Follow-up prompt to submit as the next user message. - `String prompt` Prompt text to submit as the next user turn. - `Optional structuredAction` Structured action in the same message to execute on click. - `Optional actionId` UUID of a `structured_action` content part in the same message. ### Content Part Text Payload - `class ContentPartTextPayload:` Text content part. - `String text` ### Content Part Thinking Payload - `class ContentPartThinkingPayload:` Thinking content part shown on dynamic response polling. - `List thoughts` ### Data Chart - `class DataChart:` Chart represented by explicit data series. - `Optional> series` - `String name` - `Optional> points` - `String x` - `double y` ### Open Chart Action - `class OpenChartAction:` Action to open a chart for a symbol. - `String symbol` Trading symbol to chart - `Optional extras` Additional chart configuration (indicators, overlays, etc.) - `Optional timeframe` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") ### Open Entitlement Consent Action - `class OpenEntitlementConsentAction:` Action to open entitlement consent flow for one or more accounts. - `EntitlementAgreementKey agreementKey` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` - `String reason` - `List requestedEntitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `List tradingAccountIds` ### Open Screener Action - `class OpenScreenerAction:` Action to open a stock screener with filters. - `List filters` Filter criteria for the screener - `String field` Field to filter on (e.g., "market_cap", "sector", "price") - `String operator` Comparison operator (e.g., "eq", "gte", "lte", "in") - `JsonValue value` Filter value - `Optional> fieldFilter` Optional field/column selection for screener results. - `Optional pageSize` Optional page size. - `Optional sortBy` Optional sort field for screener rows. - `Optional sortDirection` Optional sort direction (`ASC` or `DESC`). ### Prefill Cancel Order Action - `class PrefillCancelOrderAction:` Cancel-order prefill action. - `List orders` Orders to cancel using the same identifiers required by the cancel-order API. - `long accountId` Account ID (from path parameter) - `String orderId` Order ID to cancel (from path parameter) ### Prefill New Order Action - `class PrefillNewOrderAction:` New-order prefill action. - `List orders` Orders to prefill using the same shape accepted by the orders API. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `RequestOrderType orderType` Type of order - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `String quantity` Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported). For OPTION (single-leg): contracts (must be an integer) - `Side side` Side of the order - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `RequestTimeInForce timeInForce` Time in force - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `Optional id` Optional client-provided unique ID (idempotency). Required to be unique per account. - `Optional expiresAt` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `Optional instrumentId` OEMS instrument UUID - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (required for LIMIT and STOP_LIMIT orders) - `Optional positionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `OPEN("OPEN")` - `CLOSE("CLOSE")` - `Optional stopPrice` Stop price (required for STOP and STOP_LIMIT orders) - `Optional symbol` Trading symbol. For equities, use the ticker symbol (e.g., "AAPL"). For options, use the OSI symbol (e.g., "AAPL 250117C00190000"). Either `symbol` or `instrument_id` must be provided. - `Optional trailingOffset` Trailing offset amount (required for trailing orders) - `Optional trailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `PRICE("PRICE")` - `BPS("BPS")` ### Prefill Order Action - `class PrefillOrderAction: A class that can be one of several variants.union` Action to prefill order details for user confirmation. The user must review and authorize the order before submission to the trading API. This action provides parsed order data that can be used to prefill an order ticket UI or submitted directly via the orders API after user confirmation. - `PrefillNewOrderAction` - `ActionType actionType` - `NEW("NEW")` - `PrefillCancelOrderAction` - `ActionType actionType` - `CANCEL("CANCEL")` ### Prompt Button Action - `class PromptButtonAction:` Prompt-style button behavior. - `String prompt` Prompt text to submit as the next user turn. ### Screener Filter - `class ScreenerFilter:` A single filter criterion for the screener. - `String field` Field to filter on (e.g., "market_cap", "sector", "price") - `String operator` Comparison operator (e.g., "eq", "gte", "lte", "in") - `JsonValue value` Filter value ### Structured Action - `class StructuredAction: A class that can be one of several variants.union` Structured actions that Omni AI can return to clients. These actions provide machine-readable instructions for the client to execute, such as prefilling an order ticket, opening a chart, or navigating to a route. - `PrefillOrder` - `PrefillOrderAction prefillOrder` Prefill an order ticket for user confirmation - `PrefillNewOrderAction` - `ActionType actionType` - `NEW("NEW")` - `PrefillCancelOrderAction` - `ActionType actionType` - `CANCEL("CANCEL")` - `OpenChart` - `OpenChartAction openChart` Open a chart for a symbol - `String symbol` Trading symbol to chart - `Optional extras` Additional chart configuration (indicators, overlays, etc.) - `Optional timeframe` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") - `OpenScreener` - `OpenScreenerAction openScreener` Open a stock screener with filters - `List filters` Filter criteria for the screener - `String field` Field to filter on (e.g., "market_cap", "sector", "price") - `String operator` Comparison operator (e.g., "eq", "gte", "lte", "in") - `JsonValue value` Filter value - `Optional> fieldFilter` Optional field/column selection for screener results. - `Optional pageSize` Optional page size. - `Optional sortBy` Optional sort field for screener rows. - `Optional sortDirection` Optional sort direction (`ASC` or `DESC`). - `OpenEntitlementConsent` - `OpenEntitlementConsentAction openEntitlementConsent` Open entitlement consent flow - `EntitlementAgreementKey agreementKey` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` - `String reason` - `List requestedEntitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `List tradingAccountIds` ### Structured Action Button Action - `class StructuredActionButtonAction:` Structured-action button behavior. - `Optional actionId` UUID of a `structured_action` content part in the same message. ### Suggested Actions Payload - `class SuggestedActionsPayload:` Suggested follow-up buttons rendered at the end of an assistant message. - `Optional> actionButtons` Ordered message-level buttons. - `String buttonId` Stable button identifier within the content part. - `String label` User-visible label. - `Optional prompt` Follow-up prompt to submit as the next user message. - `String prompt` Prompt text to submit as the next user turn. - `Optional structuredAction` Structured action in the same message to execute on click. - `Optional actionId` UUID of a `structured_action` content part in the same message. ### Symbol Chart - `class SymbolChart:` Chart for a single symbol and timeframe. - `String symbol` - `Optional timeframe` # Entitlements ## Get Entitlements `EntitlementGetEntitlementsResponse v1().omniAi().entitlements().getEntitlements(EntitlementGetEntitlementsParamsparams = EntitlementGetEntitlementsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/entitlements` List caller's active entitlement grants. ### Parameters - `EntitlementGetEntitlementsParams params` - `Optional tradingAccountId` ### Returns - `class EntitlementGetEntitlementsResponse:` - `List data` - `String agreementId` - `EntitlementCode entitlementCode` Stable entitlement code granted by an agreement. - `OMNI_ACCOUNT_DATA("omni.account_data")` - `String entitlementId` - `String grantedAt` - `long tradingAccountId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementGetEntitlementsParams; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementGetEntitlementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); EntitlementGetEntitlementsResponse response = client.v1().omniAi().entitlements().getEntitlements(); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": [ { "agreement_id": "agreement_id", "entitlement_code": "omni.account_data", "entitlement_id": "entitlement_id", "granted_at": "granted_at", "trading_account_id": 0 } ] } ``` ## Create Entitlements `EntitlementCreateEntitlementsResponse v1().omniAi().entitlements().createEntitlements(EntitlementCreateEntitlementsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/omni-ai/entitlements` Record consent and upsert one-or-more active grants. ### Parameters - `EntitlementCreateEntitlementsParams params` - `String agreementId` - `List requestedEntitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `List tradingAccountIds` ### Returns - `class EntitlementCreateEntitlementsResponse:` - `List data` - `String agreementId` - `EntitlementCode entitlementCode` Stable entitlement code granted by an agreement. - `OMNI_ACCOUNT_DATA("omni.account_data")` - `String entitlementId` - `String grantedAt` - `long tradingAccountId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementCode; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementCreateEntitlementsParams; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementCreateEntitlementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); EntitlementCreateEntitlementsParams params = EntitlementCreateEntitlementsParams.builder() .agreementId("01JZ0000000000000000000000") .addRequestedEntitlementCode(EntitlementCode.OMNI_ACCOUNT_DATA) .addTradingAccountId(100019L) .addTradingAccountId(100021L) .build(); EntitlementCreateEntitlementsResponse response = client.v1().omniAi().entitlements().createEntitlements(params); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": [ { "agreement_id": "agreement_id", "entitlement_code": "omni.account_data", "entitlement_id": "entitlement_id", "granted_at": "granted_at", "trading_account_id": 0 } ] } ``` ## Delete Entitlement `EntitlementDeleteEntitlementResponse v1().omniAi().entitlements().deleteEntitlement(EntitlementDeleteEntitlementParamsparams = EntitlementDeleteEntitlementParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/omni-ai/entitlements/{entitlement_id}` Revoke one entitlement grant by id. ### Parameters - `EntitlementDeleteEntitlementParams params` - `Optional entitlementId` ### Returns - `class EntitlementDeleteEntitlementResponse:` - `DeleteEntitlementResponse data` - `String entitlementId` - `boolean revoked` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementDeleteEntitlementParams; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementDeleteEntitlementResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); EntitlementDeleteEntitlementResponse response = client.v1().omniAi().entitlements().deleteEntitlement("entitlement_id"); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": { "entitlement_id": "entitlement_id", "revoked": true } } ``` ## Get Entitlement Agreements `EntitlementGetEntitlementAgreementsResponse v1().omniAi().entitlements().getEntitlementAgreements(EntitlementGetEntitlementAgreementsParamsparams = EntitlementGetEntitlementAgreementsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/entitlement-agreements` List current signable entitlement agreements for consent UX. ### Parameters - `EntitlementGetEntitlementAgreementsParams params` ### Returns - `class EntitlementGetEntitlementAgreementsResponse:` - `List data` - `String agreementId` - `EntitlementAgreementKey agreementKey` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` - `String documentContent` - `String documentSha256` - `List entitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `String title` - `long version` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementGetEntitlementAgreementsParams; import com.clear_street.api.models.v1.omniai.entitlements.EntitlementGetEntitlementAgreementsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); EntitlementGetEntitlementAgreementsResponse response = client.v1().omniAi().entitlements().getEntitlementAgreements(); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": [ { "agreement_id": "agreement_id", "agreement_key": "omni_account_data_access", "document_content": "document_content", "document_sha256": "document_sha256", "entitlement_codes": [ "omni.account_data" ], "title": "title", "version": 0 } ] } ``` ## Domain Types ### Delete Entitlement Response - `class DeleteEntitlementResponse:` - `String entitlementId` - `boolean revoked` ### Entitlement Agreement Key - `enum EntitlementAgreementKey:` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` ### Entitlement Agreement Resource - `class EntitlementAgreementResource:` - `String agreementId` - `EntitlementAgreementKey agreementKey` Stable entitlement agreement family key. - `OMNI_ACCOUNT_DATA_ACCESS("omni_account_data_access")` - `String documentContent` - `String documentSha256` - `List entitlementCodes` - `OMNI_ACCOUNT_DATA("omni.account_data")` - `String title` - `long version` ### Entitlement Code - `enum EntitlementCode:` Stable entitlement code granted by an agreement. - `OMNI_ACCOUNT_DATA("omni.account_data")` ### Entitlement Resource - `class EntitlementResource:` - `String agreementId` - `EntitlementCode entitlementCode` Stable entitlement code granted by an agreement. - `OMNI_ACCOUNT_DATA("omni.account_data")` - `String entitlementId` - `String grantedAt` - `long tradingAccountId` # Messages ## Get Message By ID `MessageGetMessageByIdResponse v1().omniAi().messages().getMessageById(MessageGetMessageByIdParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/messages/{message_id}` Get a finalized message by ID. Returns a single finalized message. Returns **404** if the message belongs to an in-progress assistant turn (use the response endpoint for live output). Once the turn completes, the message becomes available here. ### Parameters - `MessageGetMessageByIdParams params` - `Optional messageId` - `long accountId` Account ID for the request ### Returns - `class MessageGetMessageByIdResponse:` - `Message data` Final immutable message. - `String id` - `MessageContent content` Finalized immutable message content container. Never includes thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember2` - `Type type` - `CHART("chart")` - `UnionMember3` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember4` - `Type type` - `CUSTOM("custom")` - `String createdAt` - `MessageOutcome outcome` Immutable terminal outcome for a finalized assistant message. - `COMPLETED("completed")` - `ERRORED("errored")` - `CANCELED("canceled")` - `MessageRole role` Finalized message role in the public contract. - `USER("USER")` - `ASSISTANT("ASSISTANT")` - `long seq` - `String threadId` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.messages.MessageGetMessageByIdParams; import com.clear_street.api.models.v1.omniai.messages.MessageGetMessageByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); MessageGetMessageByIdParams params = MessageGetMessageByIdParams.builder() .messageId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); MessageGetMessageByIdResponse response = client.v1().omniAi().messages().getMessageById(params); } } ``` #### Response ```json { "data": { "content": { "parts": [ { "text": "**Pre-market as of 7:30 AM ET**\n\n ...", "type": "text" }, { "payload": { "actionButtons": [ { "buttonId": "btn_followup_0", "label": "Check my positions", "prompt": { "prompt": "What are my current positions?" } } ] }, "type": "suggested_actions" } ] }, "created_at": "2026-04-16T09:20:17.309212+00:00", "id": "019d9597-599c-7132-a7de-e5c21eaaab77", "outcome": "completed", "role": "ASSISTANT", "seq": 2, "thread_id": "019d9597-597c-7571-a0c9-a49c0e51f6eb" }, "metadata": { "request_id": "0f991501-757d-4051-bf00-6d7f452d6fcf" } } ``` ## Submit Feedback `MessageSubmitFeedbackResponse v1().omniAi().messages().submitFeedback(MessageSubmitFeedbackParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/omni-ai/messages/{message_id}/feedback` Submit feedback on a finalized assistant message. Attaches a score and optional comment to a finalized assistant message. Feedback is only valid for messages with role `ASSISTANT` that have reached a terminal outcome. ### Parameters - `MessageSubmitFeedbackParams params` - `Optional messageId` - `long accountId` Account ID for the request - `long score` Feedback score (-1, 0, +1 or 1-5) - `Optional comment` Optional feedback comment - `Optional metadata` Optional metadata ### Returns - `class MessageSubmitFeedbackResponse:` - `CreateFeedbackResponse data` - `String createdAt` - `Optional feedbackId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.messages.MessageSubmitFeedbackParams; import com.clear_street.api.models.v1.omniai.messages.MessageSubmitFeedbackResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); MessageSubmitFeedbackParams params = MessageSubmitFeedbackParams.builder() .messageId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .score(0) .build(); MessageSubmitFeedbackResponse response = client.v1().omniAi().messages().submitFeedback(params); } } ``` #### Response ```json { "data": { "created_at": "2026-04-23T16:09:51.746912+00:00", "feedback_id": "019dbb1a-d782-7f42-8dd8-a1a7ca5d48e3" }, "metadata": { "request_id": "372a359a-fd4f-4c69-8f11-d80831aa5f23" } } ``` ## Domain Types ### Create Feedback Response - `class CreateFeedbackResponse:` - `String createdAt` - `Optional feedbackId` # Responses ## Get Response By ID `ResponseGetResponseByIdResponse v1().omniAi().responses().getResponseById(ResponseGetResponseByIdParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/responses/{response_id}` Poll a response for assistant output. Returns the current snapshot of an in-progress or completed response. While the status is `queued` or `running`, the content may be partial and may include `thinking` parts. Poll this endpoint periodically until the status reaches a terminal value (`succeeded`, `failed`, or `canceled`). Once terminal, the finalized assistant message is available in thread history via `GET /omni-ai/threads/{thread_id}/messages`. ### Parameters - `ResponseGetResponseByIdParams params` - `Optional responseId` - `long accountId` Account ID for the request ### Returns - `class ResponseGetResponseByIdResponse:` - `Response data` Dynamic pollable response. - `String id` - `ResponseStatus status` Dynamic lifecycle status for a pollable response. - `QUEUED("queued")` - `RUNNING("running")` - `SUCCEEDED("succeeded")` - `FAILED("failed")` - `CANCELED("canceled")` - `String threadId` - `String userMessageId` - `Optional content` Dynamic response content container. May include thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `THINKING("thinking")` - `UnionMember2` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember3` - `Type type` - `CHART("chart")` - `UnionMember4` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember5` - `Type type` - `CUSTOM("custom")` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` - `Optional outputMessageId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.responses.ResponseGetResponseByIdParams; import com.clear_street.api.models.v1.omniai.responses.ResponseGetResponseByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ResponseGetResponseByIdParams params = ResponseGetResponseByIdParams.builder() .responseId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); ResponseGetResponseByIdResponse response = client.v1().omniAi().responses().getResponseById(params); } } ``` #### Response ```json { "data": { "content": { "parts": [ { "text": "AAPL is currently trading at ...", "type": "text" }, { "thoughts": [ "Fetching current market data for AAPL..." ], "type": "thinking" } ] }, "id": "019dbafd-db54-7523-a412-ec9195cc5d99", "output_message_id": "019dbafd-db61-73a0-8bd9-d4034d132f81", "status": "succeeded", "thread_id": "019dbafd-db54-7523-a412-ec8a292246ad", "user_message_id": "019dbafd-db56-78a2-8a91-d54a39f44174" }, "metadata": { "request_id": "abc16101-2cbc-475a-84ef-98c8c588dcbb" } } ``` ## Cancel Response `ResponseCancelResponseResponse v1().omniAi().responses().cancelResponse(ResponseCancelResponseParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/omni-ai/responses/{response_id}` Cancel a response. Requests cancellation of a queued or running response. If the response has already reached a terminal status, this is an idempotent success. A canceled turn still produces a final assistant message with outcome `canceled` in the thread history. ### Parameters - `ResponseCancelResponseParams params` - `Optional responseId` - `long accountId` Account ID for the request ### Returns - `class ResponseCancelResponseResponse:` - `CancelResponsePayload data` - `boolean canceled` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.responses.ResponseCancelResponseParams; import com.clear_street.api.models.v1.omniai.responses.ResponseCancelResponseResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ResponseCancelResponseParams params = ResponseCancelResponseParams.builder() .responseId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); ResponseCancelResponseResponse response = client.v1().omniAi().responses().cancelResponse(params); } } ``` #### Response ```json { "data": { "canceled": false }, "metadata": { "request_id": "fa26a786-f5d3-48b0-80eb-778e17af4964" } } ``` ## Domain Types ### Cancel Response Payload - `class CancelResponsePayload:` - `boolean canceled` ### Error Status - `class ErrorStatus:` Shared sanitized error payload. - `String code` - `String message` - `Optional details` ### Response - `class Response:` Dynamic pollable response. - `String id` - `ResponseStatus status` Dynamic lifecycle status for a pollable response. - `QUEUED("queued")` - `RUNNING("running")` - `SUCCEEDED("succeeded")` - `FAILED("failed")` - `CANCELED("canceled")` - `String threadId` - `String userMessageId` - `Optional content` Dynamic response content container. May include thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `THINKING("thinking")` - `UnionMember2` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember3` - `Type type` - `CHART("chart")` - `UnionMember4` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember5` - `Type type` - `CUSTOM("custom")` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` - `Optional outputMessageId` ### Response Content - `class ResponseContent:` Dynamic response content container. May include thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `THINKING("thinking")` - `UnionMember2` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember3` - `Type type` - `CHART("chart")` - `UnionMember4` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember5` - `Type type` - `CUSTOM("custom")` ### Response Content Part - `class ResponseContentPart: A class that can be one of several variants.union` Dynamic content part visible on a pollable response. - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `THINKING("thinking")` - `UnionMember2` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember3` - `Type type` - `CHART("chart")` - `UnionMember4` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember5` - `Type type` - `CUSTOM("custom")` ### Response Status - `enum ResponseStatus:` Dynamic lifecycle status for a pollable response. - `QUEUED("queued")` - `RUNNING("running")` - `SUCCEEDED("succeeded")` - `FAILED("failed")` - `CANCELED("canceled")` # Threads ## Get Threads `ThreadGetThreadsResponse v1().omniAi().threads().getThreads(ThreadGetThreadsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/threads` List conversation threads. Returns thread metadata ordered by most recently created first. Use `page_size` and `page_token` for pagination. Thread objects contain only metadata (title, timestamps) — use the messages endpoint for conversation history. ### Parameters - `ThreadGetThreadsParams params` - `long accountId` Account ID for the request - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class ThreadGetThreadsResponse:` - `List data` - `String id` - `String createdAt` - `String title` - `String updatedAt` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadsParams; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadGetThreadsParams params = ThreadGetThreadsParams.builder() .accountId(0L) .build(); ThreadGetThreadsResponse response = client.v1().omniAi().threads().getThreads(params); } } ``` #### Response ```json { "data": [ { "created_at": "2026-04-23T15:15:54.929830+00:00", "id": "019dbae9-73b3-7fe0-bd14-25fe57e91475", "title": "What is current price of AAPL?", "updated_at": "2026-04-23T15:15:54.929830+00:00" } ], "metadata": { "request_id": "eb95e1b8-d245-41b1-bbd0-cc1073e68bfd" } } ``` ## Get Thread By ID `ThreadGetThreadByIdResponse v1().omniAi().threads().getThreadById(ThreadGetThreadByIdParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/threads/{thread_id}` Get a specific thread. Returns metadata (title, timestamps) for a single thread. Does not include messages — use `GET /omni-ai/threads/{thread_id}/messages` for conversation history. ### Parameters - `ThreadGetThreadByIdParams params` - `Optional threadId` - `long accountId` Account ID for the request ### Returns - `class ThreadGetThreadByIdResponse:` - `Thread data` Thread metadata returned by list/get thread endpoints. - `String id` - `String createdAt` - `String title` - `String updatedAt` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadByIdParams; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadGetThreadByIdParams params = ThreadGetThreadByIdParams.builder() .threadId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); ThreadGetThreadByIdResponse response = client.v1().omniAi().threads().getThreadById(params); } } ``` #### Response ```json { "data": { "created_at": "2026-04-23T15:15:54.929830+00:00", "id": "019dbae9-73b3-7fe0-bd14-25fe57e91475", "title": "What is current price of AAPL?", "updated_at": "2026-04-23T15:15:54.929830+00:00" }, "metadata": { "request_id": "5683a394-6dd1-4843-8591-f102ced2e636" } } ``` ## Create Thread `ThreadCreateThreadResponse v1().omniAi().threads().createThread(ThreadCreateThreadParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/omni-ai/threads` Create a new conversation thread. Atomically creates a new thread and submits the first user turn. The response contains a `response_id` that should be polled via `GET /omni-ai/responses/{response_id}` for assistant output. Two creation modes are supported: - **instant** — provide `text` with a natural-language prompt. - **deep\_insights** — provide a `target` ticker and optional `thesis` for long-form research. ### Parameters - `ThreadCreateThreadParams params` - `long accountId` - `Type type` Thread creation mode. - `INSTANT("instant")` - `DEEP_INSIGHTS("deep_insights")` - `Optional> capabilities` - `PREFILL_ORDER("PREFILL_ORDER")` - `OPEN_CHART("OPEN_CHART")` - `OPEN_SCREENER("OPEN_SCREENER")` - `OPEN_ENTITLEMENT_CONSENT("OPEN_ENTITLEMENT_CONSENT")` - `Optional target` Deep-insights target payload. - `String ticker` - `Type type` Deep-insights target type. Launch supports ticker-only. - `TICKER("ticker")` - `Optional text` - `Optional thesis` ### Returns - `class ThreadCreateThreadResponse:` - `CreateThreadResponse data` Response payload for thread creation. - `String responseId` - `String threadId` - `String userMessageId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadCreateThreadParams; import com.clear_street.api.models.v1.omniai.threads.ThreadCreateThreadResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadCreateThreadParams params = ThreadCreateThreadParams.builder() .accountId(19816L) .type(ThreadCreateThreadParams.Type.INSTANT) .build(); ThreadCreateThreadResponse response = client.v1().omniAi().threads().createThread(params); } } ``` #### Response ```json { "data": { "response_id": "019dbae9-73b4-7760-a947-8b4bcab57c49", "thread_id": "019dbae9-73b3-7fe0-bd14-25fe57e91475", "user_message_id": "019dbae9-73b8-75b2-9c06-ac348927696d" }, "metadata": { "request_id": "f7a9ad4d-753a-403e-aa0e-ca151f991a81" } } ``` ## Get Thread Response `ThreadGetThreadResponseResponse v1().omniAi().threads().getThreadResponse(ThreadGetThreadResponseParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/threads/{thread_id}/response` Get the active response for a thread. Convenience endpoint to look up the currently active response for a thread without knowing the `response_id`. Useful when reloading a thread whose last finalized message is a `USER` message — this indicates an assistant turn is likely in progress. Returns **404** if no active response exists (the thread is idle). ### Parameters - `ThreadGetThreadResponseParams params` - `Optional threadId` - `long accountId` Account ID for the request ### Returns - `class ThreadGetThreadResponseResponse:` - `Response data` Dynamic pollable response. - `String id` - `ResponseStatus status` Dynamic lifecycle status for a pollable response. - `QUEUED("queued")` - `RUNNING("running")` - `SUCCEEDED("succeeded")` - `FAILED("failed")` - `CANCELED("canceled")` - `String threadId` - `String userMessageId` - `Optional content` Dynamic response content container. May include thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `THINKING("thinking")` - `UnionMember2` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember3` - `Type type` - `CHART("chart")` - `UnionMember4` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember5` - `Type type` - `CUSTOM("custom")` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` - `Optional outputMessageId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadResponseParams; import com.clear_street.api.models.v1.omniai.threads.ThreadGetThreadResponseResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadGetThreadResponseParams params = ThreadGetThreadResponseParams.builder() .threadId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); ThreadGetThreadResponseResponse response = client.v1().omniAi().threads().getThreadResponse(params); } } ``` #### Response ```json { "data": { "content": { "parts": [ { "text": "", "type": "text" }, { "thoughts": [ "[1/4] Running parallel analysis on AAPL -- fundamentals, technicals, sentiment, and macro..." ], "type": "thinking" } ] }, "id": "019dbb03-cf23-74e1-9c31-ef0136ff7fed", "output_message_id": "019dbb03-cf32-74d1-906b-a148d4be3da9", "status": "running", "thread_id": "019dbb03-cf22-7da0-a663-f51c756efa07", "user_message_id": "019dbb03-cf24-7b03-8286-5bfc2411b052" }, "metadata": { "request_id": "927a85a6-b11b-4cc5-a2cd-3f46ae64e85d" } } ``` ## Get Messages `ThreadGetMessagesResponse v1().omniAi().threads().getMessages(ThreadGetMessagesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/omni-ai/threads/{thread_id}/messages` List finalized messages in a thread. Returns **finalized** messages in chronological order. Messages from in-progress assistant turns are excluded — use `GET /omni-ai/threads/{thread_id}/response` or `GET /omni-ai/responses/{response_id}` for live output. If the last finalized message has role `USER`, an active response likely exists and should be polled separately. ### Parameters - `ThreadGetMessagesParams params` - `Optional threadId` - `long accountId` Account ID for the request - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class ThreadGetMessagesResponse:` - `List data` - `String id` - `MessageContent content` Finalized immutable message content container. Never includes thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember2` - `Type type` - `CHART("chart")` - `UnionMember3` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember4` - `Type type` - `CUSTOM("custom")` - `String createdAt` - `MessageOutcome outcome` Immutable terminal outcome for a finalized assistant message. - `COMPLETED("completed")` - `ERRORED("errored")` - `CANCELED("canceled")` - `MessageRole role` Finalized message role in the public contract. - `USER("USER")` - `ASSISTANT("ASSISTANT")` - `long seq` - `String threadId` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadGetMessagesParams; import com.clear_street.api.models.v1.omniai.threads.ThreadGetMessagesResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadGetMessagesParams params = ThreadGetMessagesParams.builder() .threadId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(0L) .build(); ThreadGetMessagesResponse response = client.v1().omniAi().threads().getMessages(params); } } ``` #### Response ```json { "data": [ { "content": { "parts": [ { "text": "How are the markets doing today?", "type": "text" } ] }, "created_at": "2026-04-16T09:20:17.274943+00:00", "id": "019d9597-5983-7691-8281-7ce264127740", "outcome": "completed", "role": "USER", "seq": 1, "thread_id": "019d9597-597c-7571-a0c9-a49c0e51f6eb" }, { "content": { "parts": [ { "text": "**Pre-market as of 7:30 AM ET**\n\n ...", "type": "text" }, { "payload": { "actionButtons": [ { "buttonId": "btn_followup_0", "label": "Check my positions", "prompt": { "prompt": "What are my current positions?" } } ] }, "type": "suggested_actions" } ] }, "created_at": "2026-04-16T09:20:17.309212+00:00", "id": "019d9597-599c-7132-a7de-e5c21eaaab77", "outcome": "completed", "role": "ASSISTANT", "seq": 2, "thread_id": "019d9597-597c-7571-a0c9-a49c0e51f6eb" } ], "metadata": { "request_id": "664c0f85-cdab-4fac-afe3-8ecc0148cd4a" } } ``` ## Create Message `ThreadCreateMessageResponse v1().omniAi().threads().createMessage(ThreadCreateMessageParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/omni-ai/threads/{thread_id}/messages` Continue an existing conversation thread. Appends a new user message to the thread and starts an assistant response. Only one response may be active per thread at a time — if the previous turn is still in progress, this endpoint returns **409 Conflict**. Wait for the active response to reach a terminal status before submitting the next turn. Poll the returned `response_id` via `GET /omni-ai/responses/{response_id}` for assistant output. ### Parameters - `ThreadCreateMessageParams params` - `Optional threadId` - `long accountId` - `String text` - `Optional> capabilities` - `PREFILL_ORDER("PREFILL_ORDER")` - `OPEN_CHART("OPEN_CHART")` - `OPEN_SCREENER("OPEN_SCREENER")` - `OPEN_ENTITLEMENT_CONSENT("OPEN_ENTITLEMENT_CONSENT")` ### Returns - `class ThreadCreateMessageResponse:` - `CreateMessageResponse data` Response payload for continuing a thread with a new message. - `String responseId` - `String threadId` - `String userMessageId` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.omniai.threads.ThreadCreateMessageParams; import com.clear_street.api.models.v1.omniai.threads.ThreadCreateMessageResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); ThreadCreateMessageParams params = ThreadCreateMessageParams.builder() .threadId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountId(19816L) .text("Compare that to AMD.") .build(); ThreadCreateMessageResponse response = client.v1().omniAi().threads().createMessage(params); } } ``` #### Response ```json { "data": { "response_id": "019dbaec-8dd3-7fa3-89d0-5303609f125f", "thread_id": "019dbae9-73b3-7fe0-bd14-25fe57e91475", "user_message_id": "019dbaec-8dd4-7f91-bce2-3ec8fba79eb7" }, "metadata": { "request_id": "48775400-61f4-4c6c-bc6d-8f4996c571c7" } } ``` ## Domain Types ### Create Message Response - `class CreateMessageResponse:` Response payload for continuing a thread with a new message. - `String responseId` - `String threadId` - `String userMessageId` ### Create Thread Response - `class CreateThreadResponse:` Response payload for thread creation. - `String responseId` - `String threadId` - `String userMessageId` ### Message - `class Message:` Final immutable message. - `String id` - `MessageContent content` Finalized immutable message content container. Never includes thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember2` - `Type type` - `CHART("chart")` - `UnionMember3` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember4` - `Type type` - `CUSTOM("custom")` - `String createdAt` - `MessageOutcome outcome` Immutable terminal outcome for a finalized assistant message. - `COMPLETED("completed")` - `ERRORED("errored")` - `CANCELED("canceled")` - `MessageRole role` Finalized message role in the public contract. - `USER("USER")` - `ASSISTANT("ASSISTANT")` - `long seq` - `String threadId` - `Optional error` Shared sanitized error payload. - `String code` - `String message` - `Optional details` ### Message Content - `class MessageContent:` Finalized immutable message content container. Never includes thinking parts. - `List parts` - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember2` - `Type type` - `CHART("chart")` - `UnionMember3` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember4` - `Type type` - `CUSTOM("custom")` ### Message Content Part - `class MessageContentPart: A class that can be one of several variants.union` Final immutable content part visible on persisted messages. - `UnionMember0` - `Type type` - `TEXT("text")` - `UnionMember1` - `Type type` - `STRUCTURED_ACTION("structured_action")` - `UnionMember2` - `Type type` - `CHART("chart")` - `UnionMember3` - `Type type` - `SUGGESTED_ACTIONS("suggested_actions")` - `UnionMember4` - `Type type` - `CUSTOM("custom")` ### Message Outcome - `enum MessageOutcome:` Immutable terminal outcome for a finalized assistant message. - `COMPLETED("completed")` - `ERRORED("errored")` - `CANCELED("canceled")` ### Message Role - `enum MessageRole:` Finalized message role in the public contract. - `USER("USER")` - `ASSISTANT("ASSISTANT")` ### Thread - `class Thread:` Thread metadata returned by list/get thread endpoints. - `String id` - `String createdAt` - `String title` - `String updatedAt` # Orders ## Get Orders `OrderGetOrdersResponse v1().orders().getOrders(OrderGetOrdersParamsparams = OrderGetOrdersParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/orders` List orders for an account with optional filtering ### Parameters - `OrderGetOrdersParams params` - `Optional accountId` - `Optional from` The start date and time for the query range, inclusive (ISO 8601 format) - `Optional> instrumentIds` Comma-separated OEMS instrument UUIDs - `Optional instrumentType` Instrument type filter (e.g., COMMON_STOCK, OPTION) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional> status` Comma-separated order statuses to filter by - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `Optional symbol` Filter by symbol - `Optional to` The end date and time for the query range, inclusive (ISO 8601 format) - `Optional underlyingInstrumentIds` Comma-separated OEMS instrument UUIDs. Matches options orders whose resolved underlier is any of the given IDs. ### Returns - `class OrderGetOrdersResponse:` - `List data` - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.orders.OrderGetOrdersParams; import com.clear_street.api.models.v1.orders.OrderGetOrdersResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderGetOrdersResponse response = client.v1().orders().getOrders(0L); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "average_fill_price": "149.95", "client_order_id": "my-ref-id-20251001-001", "created_at": "2025-10-31T13:30:00.000000000Z", "filled_quantity": "50", "id": "0195f6c7-4f64-7e3c-8b0a-1d8e4f5e6a7b", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "150.00", "order_type": "LIMIT", "quantity": "100", "side": "BUY", "status": "PARTIALLY_FILLED", "stop_price": null, "symbol": "AAPL", "time_in_force": "DAY", "updated_at": "2025-10-31T13:35:10.000000000Z" }, { "account_id": 19816, "average_fill_price": "450.75", "client_order_id": "my-ref-id-20251001-002", "created_at": "2025-10-31T14:00:00.000000000Z", "filled_quantity": "200", "id": "0195f6c8-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "instrument_id": "b2b3b4b5-c2c3-d2d3-e2e3-e4e5e6e7e8e9", "instrument_type": "COMMON_STOCK", "leaves_quantity": "0", "limit_price": null, "order_type": "MARKET", "quantity": "200", "side": "SELL", "status": "FILLED", "stop_price": null, "symbol": "MSFT", "time_in_force": "DAY", "updated_at": "2025-10-31T14:00:05.000000000Z" } ], "error": null, "metadata": { "next_page_token": "cGFnZT0yJmxhc3RfaWQ9b3JkXzRjRDVlNkY3ZzhIOWkwSjE=", "page_number": 1, "request_id": "d9a4f5b6-c3d4-6e5f-0a1b-7c8d9e0f1a2b", "total_items": 25, "total_pages": 3 } } ``` ## Get Order By ID `OrderGetOrderByIdResponse v1().orders().getOrderById(OrderGetOrderByIdParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/orders/{order_id}` Get Order By ID ### Parameters - `OrderGetOrderByIdParams params` - `long accountId` - `Optional orderId` ### Returns - `class OrderGetOrderByIdResponse:` - `Order data` A trading order with its current state and execution details. This is the unified API representation of an order across its lifecycle, combining data from execution reports, order status queries, and parent/child tracking. - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.orders.OrderGetOrderByIdParams; import com.clear_street.api.models.v1.orders.OrderGetOrderByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderGetOrderByIdParams params = OrderGetOrderByIdParams.builder() .accountId(0L) .orderId("order_id") .build(); OrderGetOrderByIdResponse response = client.v1().orders().getOrderById(params); } } ``` #### Response ```json { "data": { "account_id": 19816, "average_fill_price": "149.95", "created_at": "2025-10-31T13:30:00.000000000Z", "filled_quantity": "50", "id": "my-ref-id-20251001-001", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "150.00", "order_type": "LIMIT", "quantity": "100", "side": "BUY", "status": "PARTIALLY_FILLED", "stop_price": null, "symbol": "AAPL", "time_in_force": "DAY", "updated_at": "2025-10-31T13:35:10.000000000Z" }, "error": null, "metadata": { "request_id": "0c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f" } } ``` ## Submit Orders `OrderSubmitOrdersResponse v1().orders().submitOrders(OrderSubmitOrdersParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/accounts/{account_id}/orders` Submit new orders ### Parameters - `OrderSubmitOrdersParams params` - `Optional accountId` - `List orders` - `class NewOrderMultilegRequest:` Multileg strategy order request - `List legs` Legs that compose the strategy. - `SecurityType instrumentType` Security type for the leg. - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String ratio` Ratio for the leg. - `String security` Trading symbol (e.g. "AAPL" or OSI symbol for options) - `Side side` Leg side. - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `Optional id` Optional leg reference identifier. - `Optional positionEffect` Optional leg position effect. - `OPEN("OPEN")` - `CLOSE("CLOSE")` - `RequestOrderType orderType` Type of order (currently MARKET or LIMIT for multileg strategy submission) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `RequestTimeInForce timeInForce` Time in force - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `Optional id` Optional client-provided unique ID (idempotency). Required to be unique per account. - `Optional limitPrice` Strategy price, required for LIMIT orders. - `Optional quantity` Optional strategy-level quantity. Multiplies leg quantities. Defaults to 1. - `class NewOrderRequest:` Request to submit a new order (PlaceOrderRequest from spec) - `SecurityType instrumentType` Type of security - `RequestOrderType orderType` Type of order - `String quantity` Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported). For OPTION (single-leg): contracts (must be an integer) - `Side side` Side of the order - `RequestTimeInForce timeInForce` Time in force - `Optional id` Optional client-provided unique ID (idempotency). Required to be unique per account. - `Optional expiresAt` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `Optional instrumentId` OEMS instrument UUID - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (required for LIMIT and STOP_LIMIT orders) - `Optional positionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `Optional stopPrice` Stop price (required for STOP and STOP_LIMIT orders) - `Optional symbol` Trading symbol. For equities, use the ticker symbol (e.g., "AAPL"). For options, use the OSI symbol (e.g., "AAPL 250117C00190000"). Either `symbol` or `instrument_id` must be provided. - `Optional trailingOffset` Trailing offset amount (required for trailing orders) - `Optional trailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `PRICE("PRICE")` - `BPS("BPS")` ### Returns - `class OrderSubmitOrdersResponse:` - `List data` - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.SecurityType; import com.clear_street.api.models.v1.orders.OrderSubmitOrdersParams; import com.clear_street.api.models.v1.orders.OrderSubmitOrdersResponse; import com.clear_street.api.models.v1.orders.RequestOrderType; import com.clear_street.api.models.v1.orders.RequestTimeInForce; import com.clear_street.api.models.v1.orders.Side; import java.util.List; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderSubmitOrdersParams params = OrderSubmitOrdersParams.builder() .accountId(0L) .addOrder(OrderSubmitOrdersParams.Order.NewOrderMultilegRequest.builder() .legs(List.of( OrderSubmitOrdersParams.Order.NewOrderMultilegRequest.Leg.builder() .instrumentType(SecurityType.OPTION) .ratio("ratio") .security("0193bb84-447a-706f-996f-097254663f02") .side(Side.BUY) .build(), OrderSubmitOrdersParams.Order.NewOrderMultilegRequest.Leg.builder() .instrumentType(SecurityType.OPTION) .ratio("ratio") .security("0193bb84-4db4-78ec-b4fd-cba8be61cf8a") .side(Side.SELL) .build(), OrderSubmitOrdersParams.Order.NewOrderMultilegRequest.Leg.builder() .instrumentType(SecurityType.OPTION) .ratio("ratio") .security("0193bb84-5264-7f20-8fd3-35df82cd6ef0") .side(Side.BUY) .build() )) .orderType(RequestOrderType.LIMIT) .timeInForce(RequestTimeInForce.DAY) .build()) .build(); OrderSubmitOrdersResponse response = client.v1().orders().submitOrders(params); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "average_fill_price": null, "client_order_id": "my-ref-id-20251003-001", "created_at": "2025-10-03T14:01:15.000000000Z", "filled_quantity": "0", "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e01", "instrument_id": "c3c4c5c6-d3d4-e3e4-f3f4-f5f6f7f8f9fa", "instrument_type": "COMMON_STOCK", "leaves_quantity": "25", "limit_price": null, "order_type": "MARKET", "quantity": "25", "side": "SELL", "status": "PENDING_NEW", "stop_price": null, "symbol": "GOOG", "time_in_force": "DAY", "updated_at": "2025-10-03T14:01:15.000000000Z", "venue": "XNAS" }, { "account_id": 19816, "average_fill_price": null, "client_order_id": "my-ref-id-20251003-002", "created_at": "2025-10-03T14:01:15.000000000Z", "filled_quantity": "0", "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "instrument_id": "d4d5d6d7-e4e5-f4f5-a4a5-a6a7a8a9aaab", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "180.00", "order_type": "LIMIT", "quantity": "50", "side": "BUY", "status": "PENDING_NEW", "stop_price": null, "symbol": "TSLA", "time_in_force": "DAY", "updated_at": "2025-10-03T14:01:15.000000000Z", "venue": "XNAS" } ], "error": null, "metadata": { "request_id": "ea0b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d" } } ``` ## Replace Order `OrderReplaceOrderResponse v1().orders().replaceOrder(OrderReplaceOrderParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **patch** `/v1/accounts/{account_id}/orders/{order_id}` Replace an order with new parameters ### Parameters - `OrderReplaceOrderParams params` - `long accountId` - `Optional orderId` - `Optional limitPrice` New limit price for the order - `Optional quantity` New quantity for the order - `Optional stopPrice` New stop price for the order - `Optional timeInForce` New time in force for the order ### Returns - `class OrderReplaceOrderResponse:` - `Order data` A trading order with its current state and execution details. This is the unified API representation of an order across its lifecycle, combining data from execution reports, order status queries, and parent/child tracking. - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.orders.OrderReplaceOrderParams; import com.clear_street.api.models.v1.orders.OrderReplaceOrderResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderReplaceOrderParams params = OrderReplaceOrderParams.builder() .accountId(0L) .orderId("order_id") .build(); OrderReplaceOrderResponse response = client.v1().orders().replaceOrder(params); } } ``` #### Response ```json { "data": { "account_id": 19816, "average_fill_price": "149.95", "created_at": "2025-10-31T13:30:00.000000000Z", "filled_quantity": "50", "id": "my-ref-id-20251001-001", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "150.50", "order_type": "LIMIT", "quantity": "125", "side": "BUY", "status": "PENDING_REPLACE", "stop_price": null, "symbol": "AAPL", "time_in_force": "DAY", "updated_at": "2025-10-31T14:10:00.000000000Z" }, "error": null, "metadata": { "request_id": "1d2e3f4a-5b6c-7d8e-9f0a-1b2c3d4e5f6a" } } ``` ## Cancel Open Order `OrderCancelOpenOrderResponse v1().orders().cancelOpenOrder(OrderCancelOpenOrderParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/accounts/{account_id}/orders/{order_id}` Cancel a specific order ### Parameters - `OrderCancelOpenOrderParams params` - `long accountId` - `Optional orderId` ### Returns - `class OrderCancelOpenOrderResponse:` - `Order data` A trading order with its current state and execution details. This is the unified API representation of an order across its lifecycle, combining data from execution reports, order status queries, and parent/child tracking. - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.orders.OrderCancelOpenOrderParams; import com.clear_street.api.models.v1.orders.OrderCancelOpenOrderResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderCancelOpenOrderParams params = OrderCancelOpenOrderParams.builder() .accountId(0L) .orderId("order_id") .build(); OrderCancelOpenOrderResponse response = client.v1().orders().cancelOpenOrder(params); } } ``` #### Response ```json { "data": { "account_id": 19816, "average_fill_price": "149.95", "created_at": "2025-10-31T13:30:00.000000000Z", "filled_quantity": "50", "id": "my-ref-id-20251001-001", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "150.50", "order_type": "LIMIT", "quantity": "125", "side": "BUY", "status": "PENDING_CANCEL", "stop_price": null, "symbol": "AAPL", "time_in_force": "DAY", "updated_at": "2025-10-31T14:15:00.000000000Z" }, "error": null, "metadata": { "request_id": "2e3f4a5b-6c7d-8e9f-0a1b-2c3d4e5f6a7b" } } ``` ## Cancel All Open Orders `OrderCancelAllOpenOrdersResponse v1().orders().cancelAllOpenOrders(OrderCancelAllOpenOrdersParamsparams = OrderCancelAllOpenOrdersParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/accounts/{account_id}/orders` Cancel all orders for an account ### Parameters - `OrderCancelAllOpenOrdersParams params` - `Optional accountId` - `Optional> instrumentIds` Comma-separated OEMS instrument UUIDs - `Optional instrumentType` Filter by instrument type (e.g., COMMON_STOCK, OPTION) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional side` Filter by order side (BUY or SELL) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `Optional type` Filter by order type (e.g., MARKET, LIMIT) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` ### Returns - `class OrderCancelAllOpenOrdersResponse:` - `List data` - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.orders.OrderCancelAllOpenOrdersParams; import com.clear_street.api.models.v1.orders.OrderCancelAllOpenOrdersResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); OrderCancelAllOpenOrdersResponse response = client.v1().orders().cancelAllOpenOrders(0L); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "average_fill_price": "149.95", "created_at": "2025-10-31T13:30:00.000000000Z", "filled_quantity": "50", "id": "019c0b48-b8fb-700d-8c5e-931d54555f54", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "leaves_quantity": "50", "limit_price": "150.00", "order_type": "LIMIT", "quantity": "100", "side": "BUY", "status": "PENDING_CANCEL", "stop_price": null, "symbol": "AAPL", "time_in_force": "DAY", "updated_at": "2025-10-31T14:15:00.000000000Z" }, { "account_id": 19816, "average_fill_price": null, "created_at": "2025-10-31T14:00:00.000000000Z", "filled_quantity": "0", "id": "019c0b49-03af-70d1-8eeb-d69836c9840b", "instrument_id": "b2b3b4b5-c2c3-d2d3-e2e3-e4e5e6e7e8e9", "instrument_type": "COMMON_STOCK", "leaves_quantity": "200", "limit_price": "450.00", "order_type": "LIMIT", "quantity": "200", "side": "SELL", "status": "PENDING_CANCEL", "stop_price": null, "symbol": "MSFT", "time_in_force": "DAY", "updated_at": "2025-10-31T14:15:00.000000000Z" } ], "error": null, "metadata": { "request_id": "fb1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e" } } ``` ## Domain Types ### Cancel Order Request - `class CancelOrderRequest:` Request to cancel an existing order Note: In the API, order cancellation is done via DELETE request without a body. The order_id and account_id come from the URL path parameters. - `long accountId` Account ID (from path parameter) - `String orderId` Order ID to cancel (from path parameter) ### New Order Request - `class NewOrderRequest:` Request to submit a new order (PlaceOrderRequest from spec) - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `RequestOrderType orderType` Type of order - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `String quantity` Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported). For OPTION (single-leg): contracts (must be an integer) - `Side side` Side of the order - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `RequestTimeInForce timeInForce` Time in force - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `Optional id` Optional client-provided unique ID (idempotency). Required to be unique per account. - `Optional expiresAt` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `Optional instrumentId` OEMS instrument UUID - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (required for LIMIT and STOP_LIMIT orders) - `Optional positionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `OPEN("OPEN")` - `CLOSE("CLOSE")` - `Optional stopPrice` Stop price (required for STOP and STOP_LIMIT orders) - `Optional symbol` Trading symbol. For equities, use the ticker symbol (e.g., "AAPL"). For options, use the OSI symbol (e.g., "AAPL 250117C00190000"). Either `symbol` or `instrument_id` must be provided. - `Optional trailingOffset` Trailing offset amount (required for trailing orders) - `Optional trailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `PRICE("PRICE")` - `BPS("BPS")` ### Order - `class Order:` A trading order with its current state and execution details. This is the unified API representation of an order across its lifecycle, combining data from execution reports, order status queries, and parent/child tracking. - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Order Status - `enum OrderStatus:` Order status - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` ### Order Type - `enum OrderType:` Order type - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` ### Position Effect - `enum PositionEffect:` Position effect for options orders - `OPEN("OPEN")` - `CLOSE("CLOSE")` ### Queue State - `enum QueueState:` Parent order queue or hold state. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` ### Request Order Type - `enum RequestOrderType:` Strict order-type enum for order submission/replacement requests. - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` ### Request Time In Force - `enum RequestTimeInForce:` Strict time-in-force enum for order submission/replacement requests. - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` ### Side - `enum Side:` Side of an order - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` ### Time In Force - `enum TimeInForce:` Time in force - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` ### Trailing Offset Type - `enum TrailingOffsetType:` Trailing offset type for trailing stop orders. - `PRICE("PRICE")` - `BPS("BPS")` # Positions ## Get Positions `PositionGetPositionsResponse v1().positions().getPositions(PositionGetPositionsParamsparams = PositionGetPositionsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/positions` Retrieves all positions for the specified trading account. ### Parameters - `PositionGetPositionsParams params` - `Optional accountId` - `Optional> instrumentIds` Comma-separated OEMS instrument UUIDs - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Optional sortBy` Field to sort by - `SYMBOL("SYMBOL")` - `INSTRUMENT_TYPE("INSTRUMENT_TYPE")` - `QUANTITY("QUANTITY")` - `MARKET_VALUE("MARKET_VALUE")` - `POSITION_TYPE("POSITION_TYPE")` - `UNREALIZED_PNL("UNREALIZED_PNL")` - `DAILY_UNREALIZED_PNL("DAILY_UNREALIZED_PNL")` - `Optional sortDirection` Sort direction - `ASC("ASC")` - `DESC("DESC")` ### Returns - `class PositionGetPositionsResponse:` - `List data` - `long accountId` The account this position belongs to - `String availableQuantity` The quantity of a position that is free to be operated on. - `String instrumentId` OEMS instrument UUID - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String marketValue` The current market value of the position - `PositionType positionType` The type of position - `LONG("LONG")` - `SHORT("SHORT")` - `LONG_CALL("LONG_CALL")` - `SHORT_CALL("SHORT_CALL")` - `LONG_PUT("LONG_PUT")` - `SHORT_PUT("SHORT_PUT")` - `String quantity` The number of shares or contracts. Can be positive (long) or negative (short) - `String symbol` The trading symbol for the instrument - `Optional avgPrice` The average price paid per share or contract for this position - `Optional closingPrice` The closing price used to value the position for the last trading day - `Optional closingPriceDate` The market date associated with `closing_price` - `Optional costBasis` The total cost basis for this position - `Optional dailyUnrealizedPnl` The unrealized profit or loss for this position relative to the previous close - `Optional dailyUnrealizedPnlPct` The unrealized profit/loss for the position for the current day, expressed as a percentage of the baseline value (range: 0-100). - `Optional instrumentPrice` The current market price of the instrument - `Optional underlyingInstrumentId` OEMS instrument identifier of the underlying instrument, if resolvable - `Optional unrealizedPnl` The total unrealized profit or loss for this position based on current market value - `Optional unrealizedPnlPct` The unrealized profit/loss for the position, expressed as a percentage of the position's cost basis (range: 0-100). ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionGetPositionsParams; import com.clear_street.api.models.v1.positions.PositionGetPositionsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionGetPositionsResponse response = client.v1().positions().getPositions(0L); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "available_quantity": "100", "avg_price": "145.00", "closing_price": "150.50", "closing_price_date": "2025-10-31", "cost_basis": "14500.00", "instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_price": "151.00", "instrument_type": "COMMON_STOCK", "market_value": "15050.00", "position_type": "LONG", "quantity": "100", "symbol": "AAPL", "unrealized_pnl": "550.00" }, { "account_id": 19816, "available_quantity": "100", "avg_price": "180.00", "closing_price": "180.00", "closing_price_date": "2025-10-30", "cost_basis": "-9000.00", "instrument_id": "d4d5d6d7-e4e5-f4f5-a4a5-a6a7a8a9aaab", "instrument_price": "178.50", "instrument_type": "COMMON_STOCK", "market_value": "-9000.00", "position_type": "SHORT", "quantity": "-50", "symbol": "TSLA", "unrealized_pnl": "75.00" }, { "account_id": 19816, "available_quantity": "100", "avg_price": "2.50", "closing_price": "2.70", "closing_price_date": "2025-10-30", "cost_basis": "2500.00", "instrument_id": "e5e6e7e8-f5f6-a5a6-b5b6-b7b8b9babcbe", "instrument_price": "2.72", "instrument_type": "OPTION", "market_value": "2700.00", "position_type": "LONG_CALL", "quantity": "10", "symbol": "AAPL250117C00190000", "underlying_instrument_id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "unrealized_pnl": "200.00" } ], "error": null, "metadata": { "next_page_token": "cGFnZT0yJmxhc3Rfc3ltYm9sPVRTM0E=", "page_number": 1, "request_id": "3f4a5b6c-7d8e-9f0a-1b2c-3d4e5f6a7b8c", "total_items": 25, "total_pages": 3 } } ``` ## Close Positions `PositionClosePositionsResponse v1().positions().closePositions(PositionClosePositionsParamsparams = PositionClosePositionsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/accounts/{account_id}/positions` Delete all positions within an account. Closes all positions for the specified trading account. ### Parameters - `PositionClosePositionsParams params` - `Optional accountId` - `Optional cancelOrders` Whether to cancel existing open orders for the position before submitting closing orders. ### Returns - `class PositionClosePositionsResponse:` - `List data` - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionClosePositionsParams; import com.clear_street.api.models.v1.positions.PositionClosePositionsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionClosePositionsResponse response = client.v1().positions().closePositions(0L); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "average_fill_price": null, "created_at": "2025-10-03T14:01:15.000000000Z", "filled_quantity": "0", "id": "019c0b57-0850-7b0b-8a2c-5ee3fb5a5876", "instrument_id": "c3c4c5c6-d3d4-e3e4-f3f4-f5f6f7f8f9fa", "instrument_type": "COMMON_STOCK", "leaves_quantity": "25", "limit_price": null, "order_type": "MARKET", "quantity": "25", "side": "SELL", "status": "PENDING_NEW", "stop_price": null, "symbol": "GOOG", "time_in_force": "DAY", "updated_at": "2025-10-03T14:01:15.000000000Z", "venue": "XNMS" } ], "error": null, "metadata": { "request_id": "3f4a5b6c-7d8e-9f0a-1b2c-3d4e5f6a7b8c" } } ``` ## Close Position `PositionClosePositionResponse v1().positions().closePosition(PositionClosePositionParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/accounts/{account_id}/positions/{instrument_id}` Delete a position within an account for an instrument. Retrieves orders generated to close the position. ### Parameters - `PositionClosePositionParams params` - `long accountId` - `Optional instrumentId` OEMS instrument UUID - `Optional cancelOrders` Whether to cancel existing open orders for the position before submitting closing orders. ### Returns - `class PositionClosePositionResponse:` - `List data` - `String id` Engine-assigned unique identifier for this order (UUID). - `long accountId` Account placing the order - `String clientOrderId` Client-provided identifier echoed back (FIX tag 11). - `LocalDateTime createdAt` Timestamp when order was created (UTC) - `String filledQuantity` Cumulative filled quantity - `String instrumentId` OEMS instrument UUID for the traded instrument. - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String leavesQuantity` Remaining unfilled quantity - `OrderType orderType` Type of order (MARKET, LIMIT, etc.) - `MARKET("MARKET")` - `LIMIT("LIMIT")` - `STOP("STOP")` - `STOP_LIMIT("STOP_LIMIT")` - `TRAILING_STOP("TRAILING_STOP")` - `TRAILING_STOP_LIMIT("TRAILING_STOP_LIMIT")` - `OTHER("OTHER")` - `String quantity` Total order quantity - `Side side` Side of the order (BUY, SELL, SELL_SHORT) - `BUY("BUY")` - `SELL("SELL")` - `SELL_SHORT("SELL_SHORT")` - `OTHER("OTHER")` - `OrderStatus status` Current status of the order - `PENDING_NEW("PENDING_NEW")` - `NEW("NEW")` - `PARTIALLY_FILLED("PARTIALLY_FILLED")` - `FILLED("FILLED")` - `CANCELED("CANCELED")` - `REJECTED("REJECTED")` - `EXPIRED("EXPIRED")` - `PENDING_CANCEL("PENDING_CANCEL")` - `PENDING_REPLACE("PENDING_REPLACE")` - `REPLACED("REPLACED")` - `DONE_FOR_DAY("DONE_FOR_DAY")` - `STOPPED("STOPPED")` - `SUSPENDED("SUSPENDED")` - `CALCULATED("CALCULATED")` - `OTHER("OTHER")` - `String symbol` Trading symbol - `TimeInForce timeInForce` Time in force instruction - `DAY("DAY")` - `GOOD_TILL_CANCEL("GOOD_TILL_CANCEL")` - `IMMEDIATE_OR_CANCEL("IMMEDIATE_OR_CANCEL")` - `FILL_OR_KILL("FILL_OR_KILL")` - `GOOD_TILL_DATE("GOOD_TILL_DATE")` - `AT_THE_OPENING("AT_THE_OPENING")` - `AT_THE_CLOSE("AT_THE_CLOSE")` - `GOOD_TILL_CROSSING("GOOD_TILL_CROSSING")` - `GOOD_THROUGH_CROSSING("GOOD_THROUGH_CROSSING")` - `AT_CROSSING("AT_CROSSING")` - `OTHER("OTHER")` - `LocalDateTime updatedAt` Timestamp of the most recent update (UTC) - `String venue` MIC code of the venue where the order is routed - `Optional averageFillPrice` Average fill price across all executions - `Optional> details` Contains execution, rejection or cancellation details, if any - `Optional expiresAt` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `Optional extendedHours` Whether the order is eligible for extended-hours trading. - `Optional limitOffset` Limit offset for trailing stop-limit orders (signed) - `Optional limitPrice` Limit price (for LIMIT and STOP_LIMIT orders) - `Optional queueState` Parent order queue state, present when the order is awaiting release or released. - `AWAITING_RELEASE("AWAITING_RELEASE")` - `RELEASED("RELEASED")` - `Optional releasesAt` Scheduled release time for orders awaiting release. - `Optional stopPrice` Stop price (for STOP and STOP_LIMIT orders) - `Optional trailingLimitPx` Current trailing limit price computed by the trailing strategy - `Optional trailingOffset` Trailing offset amount for trailing orders - `Optional trailingOffsetType` Trailing offset type for trailing orders - `PRICE("PRICE")` - `BPS("BPS")` - `Optional trailingStopPx` Current trailing stop price computed by the trailing strategy - `Optional trailingWatermarkPx` Trailing watermark price for trailing orders - `Optional trailingWatermarkTs` Trailing watermark timestamp for trailing orders - `Optional underlyingInstrumentId` OEMS instrument ID of the option's underlying instrument. Populated only for OPTIONS orders; `null` for non-options and for options whose underlier cannot be resolved from the instrument cache. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionClosePositionParams; import com.clear_street.api.models.v1.positions.PositionClosePositionResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionClosePositionParams params = PositionClosePositionParams.builder() .accountId(0L) .instrumentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build(); PositionClosePositionResponse response = client.v1().positions().closePosition(params); } } ``` #### Response ```json { "data": [ { "account_id": 19816, "average_fill_price": null, "created_at": "2025-10-03T14:01:15.000000000Z", "filled_quantity": "0", "id": "019c0b56-2119-7482-a80f-5a2a316524d9", "instrument_id": "c3c4c5c6-d3d4-e3e4-f3f4-f5f6f7f8f9fa", "instrument_type": "COMMON_STOCK", "leaves_quantity": "25", "limit_price": null, "order_type": "MARKET", "quantity": "25", "side": "SELL", "status": "PENDING_NEW", "stop_price": null, "symbol": "GOOG", "time_in_force": "DAY", "updated_at": "2025-10-03T14:01:15.000000000Z", "venue": "XNMS" } ], "error": null, "metadata": { "request_id": "3f4a5b6c-7d8e-9f0a-1b2c-3d4e5f6a7b8c" } } ``` ## List Position Instructions `PositionGetPositionInstructionsResponse v1().positions().getPositionInstructions(PositionGetPositionInstructionsParamsparams = PositionGetPositionInstructionsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/accounts/{account_id}/positions/instructions` Returns the current lifecycle state of the account's position instructions. Optionally filter by a specific contract. ### Parameters - `PositionGetPositionInstructionsParams params` - `Optional accountId` - `Optional instrumentId` Limit results to a single contract. Accepts the instrument id or the OSI symbol. ### Returns - `class PositionGetPositionInstructionsResponse:` - `List data` - `String id` Server-assigned id. Used as the path parameter on cancel. - `long accountId` Account the instruction belongs to. - `String instructionId` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `PositionInstructionType instructionType` The action this instruction requests. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` - `String instrumentId` Identifier of the options contract this instruction acts on. - `String quantity` Number of contracts included in the instruction. - `PositionInstructionStatus status` Current lifecycle status. - `SENT("SENT")` - `ACCEPTED("ACCEPTED")` - `REJECTED("REJECTED")` - `ENGINE_REJECTED("ENGINE_REJECTED")` - `CANCEL_REQUESTED("CANCEL_REQUESTED")` - `CANCELLED("CANCELLED")` - `CANCEL_FAILED("CANCEL_FAILED")` - `UNKNOWN("UNKNOWN")` - `String symbol` Options symbol (OSI) for display. - `Optional acceptedQuantity` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `Optional createdAt` When the instruction was first accepted by the service. - `Optional rejectionReason` Human-readable explanation populated on any non-success terminal status — `REJECTED`, `ENGINE_REJECTED`, or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the top-level `error` field summarizes the batch; per-row detail continues to live here. - `Optional updatedAt` When the instruction's lifecycle state last changed. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionGetPositionInstructionsParams; import com.clear_street.api.models.v1.positions.PositionGetPositionInstructionsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionGetPositionInstructionsResponse response = client.v1().positions().getPositionInstructions(0L); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": [ { "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "account_id": 122503, "instruction_id": "ui-20260424-001", "instruction_type": "EXERCISE", "instrument_id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "quantity": "1", "status": "SENT", "symbol": "AAPL 280121C00195000", "accepted_quantity": null, "created_at": "2026-04-24T14:30:00Z", "rejection_reason": null, "updated_at": "2026-04-24T14:30:00Z" } ] } ``` ## Submit Position Instructions `PositionSubmitPositionInstructionsResponse v1().positions().submitPositionInstructions(PositionSubmitPositionInstructionsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/accounts/{account_id}/positions/instructions` Submit one or more position instructions (Exercise, Do-Not-Exercise, Contrary Exercise Advice) against the account. Batch semantics: - **All rows accepted** → `200 OK`. Every row is in `data` with `status = SENT`. - **Partial success** → `207 Multi-Status`. `data` contains every row; rejected rows carry `status = ENGINE_REJECTED` (or `REJECTED`) and `rejection_reason`. The top-level `error` summarizes the batch failure. - **All rows rejected** → `4xx`/`5xx` error response. The HTTP status reflects the underlying cause: `409` for duplicate `instruction_id`, `400` for validation failures such as DNE/CEA on a non-expiry day, `503` if the clearing service is unavailable. No `data` is returned. Pre-flight validation (unknown `instrument_id`, unencodable `quantity`) short-circuits the whole batch with a `4xx` before any row is submitted. ### Parameters - `PositionSubmitPositionInstructionsParams params` - `Optional accountId` - `List instructions` - `PositionInstructionType instructionType` The action to take. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` - `String instrumentId` Identifier of the options contract to act on. Unknown ids return 404. - `String quantity` Number of contracts to include in the instruction. - `Optional instructionId` Caller-supplied idempotency key. Echoed on the response. The server generates a unique id when omitted. ### Returns - `class PositionSubmitPositionInstructionsResponse:` - `List data` - `String id` Server-assigned id. Used as the path parameter on cancel. - `long accountId` Account the instruction belongs to. - `String instructionId` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `PositionInstructionType instructionType` The action this instruction requests. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` - `String instrumentId` Identifier of the options contract this instruction acts on. - `String quantity` Number of contracts included in the instruction. - `PositionInstructionStatus status` Current lifecycle status. - `SENT("SENT")` - `ACCEPTED("ACCEPTED")` - `REJECTED("REJECTED")` - `ENGINE_REJECTED("ENGINE_REJECTED")` - `CANCEL_REQUESTED("CANCEL_REQUESTED")` - `CANCELLED("CANCELLED")` - `CANCEL_FAILED("CANCEL_FAILED")` - `UNKNOWN("UNKNOWN")` - `String symbol` Options symbol (OSI) for display. - `Optional acceptedQuantity` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `Optional createdAt` When the instruction was first accepted by the service. - `Optional rejectionReason` Human-readable explanation populated on any non-success terminal status — `REJECTED`, `ENGINE_REJECTED`, or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the top-level `error` field summarizes the batch; per-row detail continues to live here. - `Optional updatedAt` When the instruction's lifecycle state last changed. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionInstructionType; import com.clear_street.api.models.v1.positions.PositionSubmitPositionInstructionsParams; import com.clear_street.api.models.v1.positions.PositionSubmitPositionInstructionsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionSubmitPositionInstructionsParams params = PositionSubmitPositionInstructionsParams.builder() .accountId(0L) .addInstruction(PositionSubmitPositionInstructionsParams.Instruction.builder() .instructionType(PositionInstructionType.EXERCISE) .instrumentId("0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02") .quantity("1") .build()) .build(); PositionSubmitPositionInstructionsResponse response = client.v1().positions().submitPositionInstructions(params); } } ``` #### Response ```json { "data": [ { "account_id": 122503, "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "instruction_id": "ui-20260424-001", "instruction_type": "EXERCISE", "instrument_id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e01", "quantity": "1", "status": "SENT", "symbol": "AAPL 280121C00195000" } ], "metadata": { "request_id": "0a5c9ebf-a9a7-4f2d-9c7e-f2b5f0b1bd01" } } ``` ## Cancel Position Instruction `PositionCancelPositionInstructionResponse v1().positions().cancelPositionInstruction(PositionCancelPositionInstructionParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/accounts/{account_id}/positions/instructions/{instruction_id}` Cancel an outstanding position instruction by its server-assigned `id`. Returns the updated instruction with status `CANCEL_REQUESTED`. The terminal `CANCELLED` or `CANCEL_FAILED` state arrives asynchronously and is observable via subsequent GETs. ### Parameters - `PositionCancelPositionInstructionParams params` - `long accountId` - `Optional instructionId` ### Returns - `class PositionCancelPositionInstructionResponse:` - `PositionInstruction data` A position instruction and its current lifecycle state. - `String id` Server-assigned id. Used as the path parameter on cancel. - `long accountId` Account the instruction belongs to. - `String instructionId` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `PositionInstructionType instructionType` The action this instruction requests. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` - `String instrumentId` Identifier of the options contract this instruction acts on. - `String quantity` Number of contracts included in the instruction. - `PositionInstructionStatus status` Current lifecycle status. - `SENT("SENT")` - `ACCEPTED("ACCEPTED")` - `REJECTED("REJECTED")` - `ENGINE_REJECTED("ENGINE_REJECTED")` - `CANCEL_REQUESTED("CANCEL_REQUESTED")` - `CANCELLED("CANCELLED")` - `CANCEL_FAILED("CANCEL_FAILED")` - `UNKNOWN("UNKNOWN")` - `String symbol` Options symbol (OSI) for display. - `Optional acceptedQuantity` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `Optional createdAt` When the instruction was first accepted by the service. - `Optional rejectionReason` Human-readable explanation populated on any non-success terminal status — `REJECTED`, `ENGINE_REJECTED`, or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the top-level `error` field summarizes the batch; per-row detail continues to live here. - `Optional updatedAt` When the instruction's lifecycle state last changed. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.positions.PositionCancelPositionInstructionParams; import com.clear_street.api.models.v1.positions.PositionCancelPositionInstructionResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); PositionCancelPositionInstructionParams params = PositionCancelPositionInstructionParams.builder() .accountId(0L) .instructionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build(); PositionCancelPositionInstructionResponse response = client.v1().positions().cancelPositionInstruction(params); } } ``` #### Response ```json { "metadata": { "request_id": "request_id", "next_page_token": "U3RhaW5sZXNzIHJvY2tz", "page_number": 0, "previous_page_token": "U3RhaW5sZXNzIHJvY2tz", "total_items": 0, "total_pages": 0 }, "error": { "code": 400, "message": "Order quantity must be greater than zero", "details": [ { "foo": "bar" } ] }, "data": { "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "account_id": 122503, "instruction_id": "ui-20260424-001", "instruction_type": "EXERCISE", "instrument_id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", "quantity": "1", "status": "SENT", "symbol": "AAPL 280121C00195000", "accepted_quantity": null, "created_at": "2026-04-24T14:30:00Z", "rejection_reason": null, "updated_at": "2026-04-24T14:30:00Z" } } ``` ## Domain Types ### Position - `class Position:` Represents a holding of a particular instrument in an account - `long accountId` The account this position belongs to - `String availableQuantity` The quantity of a position that is free to be operated on. - `String instrumentId` OEMS instrument UUID - `SecurityType instrumentType` Type of security - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `String marketValue` The current market value of the position - `PositionType positionType` The type of position - `LONG("LONG")` - `SHORT("SHORT")` - `LONG_CALL("LONG_CALL")` - `SHORT_CALL("SHORT_CALL")` - `LONG_PUT("LONG_PUT")` - `SHORT_PUT("SHORT_PUT")` - `String quantity` The number of shares or contracts. Can be positive (long) or negative (short) - `String symbol` The trading symbol for the instrument - `Optional avgPrice` The average price paid per share or contract for this position - `Optional closingPrice` The closing price used to value the position for the last trading day - `Optional closingPriceDate` The market date associated with `closing_price` - `Optional costBasis` The total cost basis for this position - `Optional dailyUnrealizedPnl` The unrealized profit or loss for this position relative to the previous close - `Optional dailyUnrealizedPnlPct` The unrealized profit/loss for the position for the current day, expressed as a percentage of the baseline value (range: 0-100). - `Optional instrumentPrice` The current market price of the instrument - `Optional underlyingInstrumentId` OEMS instrument identifier of the underlying instrument, if resolvable - `Optional unrealizedPnl` The total unrealized profit or loss for this position based on current market value - `Optional unrealizedPnlPct` The unrealized profit/loss for the position, expressed as a percentage of the position's cost basis (range: 0-100). ### Position Instruction - `class PositionInstruction:` A position instruction and its current lifecycle state. - `String id` Server-assigned id. Used as the path parameter on cancel. - `long accountId` Account the instruction belongs to. - `String instructionId` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `PositionInstructionType instructionType` The action this instruction requests. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` - `String instrumentId` Identifier of the options contract this instruction acts on. - `String quantity` Number of contracts included in the instruction. - `PositionInstructionStatus status` Current lifecycle status. - `SENT("SENT")` - `ACCEPTED("ACCEPTED")` - `REJECTED("REJECTED")` - `ENGINE_REJECTED("ENGINE_REJECTED")` - `CANCEL_REQUESTED("CANCEL_REQUESTED")` - `CANCELLED("CANCELLED")` - `CANCEL_FAILED("CANCEL_FAILED")` - `UNKNOWN("UNKNOWN")` - `String symbol` Options symbol (OSI) for display. - `Optional acceptedQuantity` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `Optional createdAt` When the instruction was first accepted by the service. - `Optional rejectionReason` Human-readable explanation populated on any non-success terminal status — `REJECTED`, `ENGINE_REJECTED`, or `CANCEL_FAILED`. On a `207 Multi-Status` batch submit the top-level `error` field summarizes the batch; per-row detail continues to live here. - `Optional updatedAt` When the instruction's lifecycle state last changed. ### Position Instruction Status - `enum PositionInstructionStatus:` Lifecycle status of a position instruction. - `SENT("SENT")` - `ACCEPTED("ACCEPTED")` - `REJECTED("REJECTED")` - `ENGINE_REJECTED("ENGINE_REJECTED")` - `CANCEL_REQUESTED("CANCEL_REQUESTED")` - `CANCELLED("CANCELLED")` - `CANCEL_FAILED("CANCEL_FAILED")` - `UNKNOWN("UNKNOWN")` ### Position Instruction Type - `enum PositionInstructionType:` The action to take against an options position. - `EXERCISE("EXERCISE")` - `DO_NOT_EXERCISE("DO_NOT_EXERCISE")` - `CONTRARY_EXERCISE("CONTRARY_EXERCISE")` ### Position Type - `enum PositionType:` Position type classification - `LONG("LONG")` - `SHORT("SHORT")` - `LONG_CALL("LONG_CALL")` - `SHORT_CALL("SHORT_CALL")` - `LONG_PUT("LONG_PUT")` - `SHORT_PUT("SHORT_PUT")` # Watchlist ## Get Watchlists `WatchlistGetWatchlistsResponse v1().watchlist().getWatchlists(WatchlistGetWatchlistsParamsparams = WatchlistGetWatchlistsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/watchlists` List watchlists for the authenticated user ### Parameters - `WatchlistGetWatchlistsParams params` - `Optional pageSize` The number of items to return per page. Only used when page_token is not provided. - `Optional pageToken` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `class WatchlistGetWatchlistsResponse:` - `List data` - `String id` The unique identifier for the watchlist. - `LocalDateTime createdAt` The timestamp when the watchlist was created. - `String name` The user-provided watchlist name. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistGetWatchlistsParams; import com.clear_street.api.models.v1.watchlist.WatchlistGetWatchlistsResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistGetWatchlistsResponse response = client.v1().watchlist().getWatchlists(); } } ``` #### Response ```json { "data": [ { "created_at": "2025-01-15T10:00:00.000000000Z", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Tech Stocks" }, { "created_at": "2025-01-10T14:30:00.000000000Z", "id": "660e8400-e29b-41d4-a716-446655440001", "name": "Dividend Portfolio" } ], "error": null, "metadata": { "next_page_token": null, "page_number": 1, "request_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "total_items": 2, "total_pages": 1 } } ``` ## Get Watchlist By ID `WatchlistGetWatchlistByIdResponse v1().watchlist().getWatchlistById(WatchlistGetWatchlistByIdParamsparams = WatchlistGetWatchlistByIdParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/watchlists/{watchlist_id}` Get a watchlist by ID with all its items ### Parameters - `WatchlistGetWatchlistByIdParams params` - `Optional watchlistId` ### Returns - `class WatchlistGetWatchlistByIdResponse:` - `WatchlistDetail data` Detailed watchlist with all items - `String id` Watchlist ID - `LocalDateTime createdAt` Creation timestamp - `List items` Items in the watchlist - `String id` Item ID - `LocalDateTime addedAt` When the item was added - `Optional addedPrice` Price when the item was added - `Optional instrument` Instrument details - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional> optionsExpiryDates` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments - `String name` Watchlist name ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistGetWatchlistByIdParams; import com.clear_street.api.models.v1.watchlist.WatchlistGetWatchlistByIdResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistGetWatchlistByIdResponse response = client.v1().watchlist().getWatchlistById("550e8400-e29b-41d4-a716-446655440000"); } } ``` #### Response ```json { "data": { "created_at": "2025-01-15T10:00:00.000000000Z", "id": "550e8400-e29b-41d4-a716-446655440000", "items": [ { "added_at": "2025-01-16T09:30:00.000000000Z", "added_price": "150.25", "id": "660e8400-e29b-41d4-a716-446655440001", "instrument": { "country_of_issue": "US", "currency": "USD", "easy_to_borrow": true, "id": "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", "instrument_type": "COMMON_STOCK", "is_liquidation_only": false, "is_marginable": true, "is_restricted": false, "is_short_prohibited": false, "is_threshold_security": false, "is_tradable": true, "name": "Apple Inc.", "symbol": "AAPL", "venue": "XNMS" } } ], "name": "Tech Stocks" }, "error": null, "metadata": { "request_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef" } } ``` ## Create Watchlist `WatchlistCreateWatchlistResponse v1().watchlist().createWatchlist(WatchlistCreateWatchlistParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/watchlists` Create Watchlist ### Parameters - `WatchlistCreateWatchlistParams params` - `String name` The desired watchlist name. ### Returns - `class WatchlistCreateWatchlistResponse:` - `WatchlistEntry data` Represents a user watchlist. - `String id` The unique identifier for the watchlist. - `LocalDateTime createdAt` The timestamp when the watchlist was created. - `String name` The user-provided watchlist name. ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistCreateWatchlistParams; import com.clear_street.api.models.v1.watchlist.WatchlistCreateWatchlistResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistCreateWatchlistParams params = WatchlistCreateWatchlistParams.builder() .name("name") .build(); WatchlistCreateWatchlistResponse response = client.v1().watchlist().createWatchlist(params); } } ``` #### Response ```json { "data": { "created_at": "2025-01-23T12:00:00.000000000Z", "id": "770e8400-e29b-41d4-a716-446655440002", "name": "Growth Stocks" }, "error": null, "metadata": { "request_id": "b2c3d4e5-f6a7-8901-2345-678901bcdefg" } } ``` ## Delete Watchlist `JsonValue v1().watchlist().deleteWatchlist(WatchlistDeleteWatchlistParamsparams = WatchlistDeleteWatchlistParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/watchlists/{watchlist_id}` Delete a watchlist and all its items ### Parameters - `WatchlistDeleteWatchlistParams params` - `Optional watchlistId` ### Returns - `class WatchlistDeleteWatchlistResponse:` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistDeleteWatchlistParams; import com.clear_street.api.models.v1.watchlist.WatchlistDeleteWatchlistResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistDeleteWatchlistResponse response = client.v1().watchlist().deleteWatchlist("550e8400-e29b-41d4-a716-446655440000"); } } ``` #### Response ```json { "data": null, "metadata": { "request_id": "cb824f1b-ea6e-4045-8169-9503be2b24d7" } } ``` ## Add Watchlist Item `WatchlistAddWatchlistItemResponse v1().watchlist().addWatchlistItem(WatchlistAddWatchlistItemParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **post** `/v1/watchlists/{watchlist_id}/items` Add an instrument to a watchlist ### Parameters - `WatchlistAddWatchlistItemParams params` - `Optional watchlistId` - `String instrumentId` OEMS instrument UUID ### Returns - `class WatchlistAddWatchlistItemResponse:` - `AddWatchlistItemData data` Response data for adding a watchlist item - `String itemId` ID of the created item ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistAddWatchlistItemParams; import com.clear_street.api.models.v1.watchlist.WatchlistAddWatchlistItemResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistAddWatchlistItemParams params = WatchlistAddWatchlistItemParams.builder() .watchlistId("550e8400-e29b-41d4-a716-446655440000") .instrumentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build(); WatchlistAddWatchlistItemResponse response = client.v1().watchlist().addWatchlistItem(params); } } ``` #### Response ```json { "data": { "item_id": "770e8400-e29b-41d4-a716-446655440002" }, "error": null, "metadata": { "request_id": "b2c3d4e5-f6a7-8901-2345-678901bcdefg" } } ``` ## Delete Watchlist Item `JsonValue v1().watchlist().deleteWatchlistItem(WatchlistDeleteWatchlistItemParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` **delete** `/v1/watchlists/{watchlist_id}/items/{item_id}` Delete an instrument from a watchlist ### Parameters - `WatchlistDeleteWatchlistItemParams params` - `String watchlistId` - `Optional itemId` ### Returns - `class WatchlistDeleteWatchlistItemResponse:` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.watchlist.WatchlistDeleteWatchlistItemParams; import com.clear_street.api.models.v1.watchlist.WatchlistDeleteWatchlistItemResponse; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); WatchlistDeleteWatchlistItemParams params = WatchlistDeleteWatchlistItemParams.builder() .watchlistId("550e8400-e29b-41d4-a716-446655440000") .itemId("660e8400-e29b-41d4-a716-446655440001") .build(); WatchlistDeleteWatchlistItemResponse response = client.v1().watchlist().deleteWatchlistItem(params); } } ``` #### Response ```json { "data": null, "metadata": { "request_id": "5b0709e3-5868-4116-9a84-26f1b8c30503" } } ``` ## Domain Types ### Add Watchlist Item Data - `class AddWatchlistItemData:` Response data for adding a watchlist item - `String itemId` ID of the created item ### Watchlist Detail - `class WatchlistDetail:` Detailed watchlist with all items - `String id` Watchlist ID - `LocalDateTime createdAt` Creation timestamp - `List items` Items in the watchlist - `String id` Item ID - `LocalDateTime addedAt` When the item was added - `Optional addedPrice` Price when the item was added - `Optional instrument` Instrument details - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional> optionsExpiryDates` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments - `String name` Watchlist name ### Watchlist Entry - `class WatchlistEntry:` Represents a user watchlist. - `String id` The unique identifier for the watchlist. - `LocalDateTime createdAt` The timestamp when the watchlist was created. - `String name` The user-provided watchlist name. ### Watchlist Item Entry - `class WatchlistItemEntry:` A single item in a watchlist - `String id` Item ID - `LocalDateTime addedAt` When the item was added - `Optional addedPrice` Price when the item was added - `Optional instrument` Instrument details - `String id` Unique OEMS instrument identifier (UUID) - `String countryOfIssue` The ISO country code of the instrument's issue - `String currency` The ISO currency code in which the instrument is traded - `boolean easyToBorrow` Indicates if the instrument is classified as Easy-To-Borrow - `boolean isLiquidationOnly` Indicates if the instrument is liquidation only and cannot be bought - `boolean isMarginable` Indicates if the instrument is marginable - `boolean isRestricted` Indicates if the instrument is restricted from trading - `boolean isShortProhibited` Indicates if short selling is prohibited for the instrument - `boolean isThresholdSecurity` Indicates if the instrument is on the Regulation SHO Threshold Security List - `boolean isTradable` Indicates if the instrument is tradable - `String symbol` The trading symbol for the instrument - `String venue` The MIC code of the primary listing venue - `Optional adv` Average daily share volume from the security definition. - `Optional expiry` The expiration date for options instruments - `Optional instrumentType` The type of security (e.g., Common Stock, ETF) - `COMMON_STOCK("COMMON_STOCK")` - `PREFERRED_STOCK("PREFERRED_STOCK")` - `OPTION("OPTION")` - `CASH("CASH")` - `OTHER("OTHER")` - `Optional longMarginRate` The percent of a long position's value you must post as margin - `Optional name` The full name of the instrument or its issuer - `Optional notionalAdv` Notional ADV (`adv × previous_close`). The primary liquidity signal used by `/instruments/search` ranking. Computed at response time so it stays consistent with whatever `adv` and `previous_close` show. - `Optional> optionsExpiryDates` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `Optional previousClose` Last close price from the security definition. - `Optional shortMarginRate` The percent of a short position's value you must post as margin - `Optional strikePrice` The strike price for options instruments # Websocket ## Websocket Handler `v1().websocket().websocketHandler(WebsocketWebsocketHandlerParamsparams = WebsocketWebsocketHandlerParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` **get** `/v1/ws` Upgrade the HTTP connection to a WebSocket and echo incoming messages. ### Parameters - `WebsocketWebsocketHandlerParams params` ### Example ```java package com.clear_street.api.example; import com.clear_street.api.client.ClearStreetClient; import com.clear_street.api.client.okhttp.ClearStreetOkHttpClient; import com.clear_street.api.models.v1.websocket.WebsocketWebsocketHandlerParams; public final class Main { private Main() {} public static void main(String[] args) { ClearStreetClient client = ClearStreetOkHttpClient.builder() .fromEnv() .apiKey("My API Key") .build(); client.v1().websocket().websocketHandler(); } } ```