# 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