# V1 ## Domain Types ### Security Type - `type SecurityType string` Security type - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` # Accounts ## Get Accounts `client.V1.Accounts.GetAccounts(ctx, query) (*V1AccountGetAccountsResponse, error)` **get** `/v1/accounts` List accounts the authenticated user has permission to access ### Parameters - `query V1AccountGetAccountsParams` - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1AccountGetAccountsResponse struct{…}` - `Data AccountList` - `ID int64` The unique identifier for the account - `AccountHolderEntityID int64` The account holder entity identifier - `FullName string` The full legal name of the account - `OpenDate Time` The date the account was opened - `OptionsLevel int64` The options level of the account - `ShortName string` The short name of the account - `Status AccountStatus` The current status of the account - `const AccountStatusActive AccountStatus = "ACTIVE"` - `const AccountStatusInactive AccountStatus = "INACTIVE"` - `const AccountStatusClosed AccountStatus = "CLOSED"` - `Subtype AccountSubtype` The sub-type of account - `const AccountSubtypeCash AccountSubtype = "CASH"` - `const AccountSubtypeMargin AccountSubtype = "MARGIN"` - `const AccountSubtypeOther AccountSubtype = "OTHER"` - `Type AccountType` The type of account - `const AccountTypeCustomer AccountType = "CUSTOMER"` - `const AccountTypeOther AccountType = "OTHER"` - `CloseDate Time` The date the account was closed, if applicable ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Accounts.GetAccounts(context.TODO(), clearstreet.V1AccountGetAccountsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Accounts.GetAccountByID(ctx, accountID) (*V1AccountGetAccountByIDResponse, error)` **get** `/v1/accounts/{account_id}` Fetch account details by ID ### Parameters - `accountID int64` ### Returns - `type V1AccountGetAccountByIDResponse struct{…}` - `Data Account` Represents a trading account - `ID int64` The unique identifier for the account - `AccountHolderEntityID int64` The account holder entity identifier - `FullName string` The full legal name of the account - `OpenDate Time` The date the account was opened - `OptionsLevel int64` The options level of the account - `ShortName string` The short name of the account - `Status AccountStatus` The current status of the account - `const AccountStatusActive AccountStatus = "ACTIVE"` - `const AccountStatusInactive AccountStatus = "INACTIVE"` - `const AccountStatusClosed AccountStatus = "CLOSED"` - `Subtype AccountSubtype` The sub-type of account - `const AccountSubtypeCash AccountSubtype = "CASH"` - `const AccountSubtypeMargin AccountSubtype = "MARGIN"` - `const AccountSubtypeOther AccountSubtype = "OTHER"` - `Type AccountType` The type of account - `const AccountTypeCustomer AccountType = "CUSTOMER"` - `const AccountTypeOther AccountType = "OTHER"` - `CloseDate Time` The date the account was closed, if applicable ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Accounts.GetAccountByID(context.TODO(), 0) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Accounts.PatchAccountByID(ctx, accountID, body) (*V1AccountPatchAccountByIDResponse, error)` **patch** `/v1/accounts/{account_id}` Update account risk settings ### Parameters - `accountID int64` - `body V1AccountPatchAccountByIDParams` - `Risk param.Field[RiskSettings]` Risk settings for the account ### Returns - `type V1AccountPatchAccountByIDResponse struct{…}` - `Data AccountSettings` - `Risk RiskSettings` Risk settings for the account - `MaxNotional string` The maximum notional value available to the account ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Accounts.PatchAccountByID( context.TODO(), 0, clearstreet.V1AccountPatchAccountByIDParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": { "risk": { "max_notional": "5000000.00" } }, "error": null, "metadata": { "request_id": "c8f3e4a5-b2c3-5d4e-9f0a-6b7c8d9e0f1a" } } ``` ## Get Account Balances `client.V1.Accounts.GetAccountBalances(ctx, accountID, query) (*V1AccountGetAccountBalancesResponse, error)` **get** `/v1/accounts/{account_id}/balances` Fetch account balance information ### Parameters - `accountID int64` - `query V1AccountGetAccountBalancesParams` - `TopMarginContributorsLimit param.Field[int64]` Limit the number of top margin contributors returned by the engine. ### Returns - `type V1AccountGetAccountBalancesResponse struct{…}` - `Data AccountBalances` Represents the balance details for a trading account - `AccountID int64` The unique identifier for the account - `BuyingPower string` The total buying power available in the account. - `Currency string` Currency identifier for all monetary values. - `DailyRealizedPnl string` Realized profit or loss since start of day. - `DailyTotalPnl string` Total profit or loss since start of day. - `DailyUnrealizedPnl string` Total unrealized profit or loss across all positions relative to prior close. - `Equity string` The total equity in the account. - `LongMarketValue string` The total market value of all long positions. - `MarginType MarginType` The applicable margin model for the account - `const MarginTypeOther MarginType = "OTHER"` - `const MarginTypeNone MarginType = "NONE"` - `const MarginTypePortfolioMargin MarginType = "PORTFOLIO_MARGIN"` - `const MarginTypeRiskBasedHaircutBrokerDealer MarginType = "RISK_BASED_HAIRCUT_BROKER_DEALER"` - `const MarginTypeRegT MarginType = "REG_T"` - `const MarginTypeRiskBasedHaircutMarketMaker MarginType = "RISK_BASED_HAIRCUT_MARKET_MAKER"` - `const MarginTypeCiro MarginType = "CIRO"` - `const MarginTypeFuturesNlv MarginType = "FUTURES_NLV"` - `const MarginTypeFuturesTotEq MarginType = "FUTURES_TOT_EQ"` - `OpenOrderAdjustment string` Signed buying-power correction from open orders. - `SettledCash string` The amount of cash that is settled and available for withdrawal or trading. - `Sod AccountBalancesSod` Start-of-day snapshot balances. - `BuyingPower string` Start-of-day buying power. - `Equity string` Start-of-day equity. - `LongMarketValue string` Start-of-day long market value. - `ShortMarketValue string` Start-of-day short market value. - `Asof Time` Timestamp for the start-of-day values. - `DayTradeBuyingPower string` Start-of-day day-trade buying power. - `MaintenanceMarginExcess string` Start-of-day maintenance margin excess. - `MaintenanceMarginRequirement string` Start-of-day maintenance margin requirement. - `TradeCash string` Start-of-day trade cash. - `TradeCash string` Trade-date effective cash. - `UnsettledCredits string` Trade-date unsettled cash credits. - `UnsettledDebits string` Trade-date unsettled cash debits. - `WithdrawableCash string` The amount of cash currently available to withdraw. - `MarginDetails MarginDetails` Margin-account-only details. - `DayTradeCount int64` The number of day trades executed over the 5 most recent trading days. - `InitialMarginExcess string` Initial margin excess for trade-date balances. - `InitialMarginRequirement string` Initial margin requirement for trade-date balances. - `MaintenanceMarginExcess string` Maintenance margin excess for trade-date balances. - `MaintenanceMarginRequirement string` Maintenance margin requirement for trade-date balances. - `PatternDayTrader bool` `true` if the account is currently flagged as a PDT, otherwise `false`. - `DayTradeBuyingPowerUsage string` The amount of day-trade buying power used during the current trading day. - `TopContributors []MarginTopContributor` Optional top margin contributors, returned only when explicitly requested. - `DayTradeBuyingPowerUsage string` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `InitialMarginRequirement string` Initial margin requirement attributable to this underlying. - `MaintenanceMarginRequirement string` Maintenance margin requirement attributable to this underlying. - `MarketValue string` Net market value attributable to this underlying. - `UnderlyingInstrumentID string` UUID of the underlying security contributing to margin requirement. - `Usage MarginDetailsUsage` Current usage totals. - `Total string` The total margin available in the current model. - `Used string` The amount of margin that is currently being utilized. - `Multiplier string` Applied multiplier for margin calculations. - `ShortMarketValue string` The total market value of all short positions. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Accounts.GetAccountBalances( context.TODO(), 0, clearstreet.V1AccountGetAccountBalancesParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Accounts.GetPortfolioHistory(ctx, accountID, query) (*V1AccountGetPortfolioHistoryResponse, error)` **get** `/v1/accounts/{account_id}/portfolio-history` Retrieves daily portfolio history for the specified account. ### Parameters - `accountID int64` - `query V1AccountGetPortfolioHistoryParams` - `StartDate param.Field[Time]` Start date for the portfolio history range, in YYYY-MM-DD format. - `EndDate param.Field[Time]` Defaults to today in America/New_York when omitted. ### Returns - `type V1AccountGetPortfolioHistoryResponse struct{…}` - `Data PortfolioHistoryResponse` - `Segments []PortfolioHistorySegment` - `Date Time` The date for this segment - `EodEquity string` The equity at the end of the trading day. - `RealizedPnl string` Sum of the profit and loss realized from position closing trading activity. - `SodEquity string` The equity at the start of the trading day. - `UnrealizedPnl string` Sum of the profit and loss from market changes. - `BoughtNotional string` Amount bought MTM - `DayPnl string` Sum of the profit and loss from intraday trading activities for the trading day. - `NetPnl string` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `PositionPnl string` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `SoldNotional string` Amount sold MTM ### Example ```go package main import ( "context" "fmt" "time" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Accounts.GetPortfolioHistory( context.TODO(), 0, clearstreet.V1AccountGetPortfolioHistoryParams{ StartDate: time.Now(), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type Account struct{…}` Represents a trading account - `ID int64` The unique identifier for the account - `AccountHolderEntityID int64` The account holder entity identifier - `FullName string` The full legal name of the account - `OpenDate Time` The date the account was opened - `OptionsLevel int64` The options level of the account - `ShortName string` The short name of the account - `Status AccountStatus` The current status of the account - `const AccountStatusActive AccountStatus = "ACTIVE"` - `const AccountStatusInactive AccountStatus = "INACTIVE"` - `const AccountStatusClosed AccountStatus = "CLOSED"` - `Subtype AccountSubtype` The sub-type of account - `const AccountSubtypeCash AccountSubtype = "CASH"` - `const AccountSubtypeMargin AccountSubtype = "MARGIN"` - `const AccountSubtypeOther AccountSubtype = "OTHER"` - `Type AccountType` The type of account - `const AccountTypeCustomer AccountType = "CUSTOMER"` - `const AccountTypeOther AccountType = "OTHER"` - `CloseDate Time` The date the account was closed, if applicable ### Account Balances - `type AccountBalances struct{…}` Represents the balance details for a trading account - `AccountID int64` The unique identifier for the account - `BuyingPower string` The total buying power available in the account. - `Currency string` Currency identifier for all monetary values. - `DailyRealizedPnl string` Realized profit or loss since start of day. - `DailyTotalPnl string` Total profit or loss since start of day. - `DailyUnrealizedPnl string` Total unrealized profit or loss across all positions relative to prior close. - `Equity string` The total equity in the account. - `LongMarketValue string` The total market value of all long positions. - `MarginType MarginType` The applicable margin model for the account - `const MarginTypeOther MarginType = "OTHER"` - `const MarginTypeNone MarginType = "NONE"` - `const MarginTypePortfolioMargin MarginType = "PORTFOLIO_MARGIN"` - `const MarginTypeRiskBasedHaircutBrokerDealer MarginType = "RISK_BASED_HAIRCUT_BROKER_DEALER"` - `const MarginTypeRegT MarginType = "REG_T"` - `const MarginTypeRiskBasedHaircutMarketMaker MarginType = "RISK_BASED_HAIRCUT_MARKET_MAKER"` - `const MarginTypeCiro MarginType = "CIRO"` - `const MarginTypeFuturesNlv MarginType = "FUTURES_NLV"` - `const MarginTypeFuturesTotEq MarginType = "FUTURES_TOT_EQ"` - `OpenOrderAdjustment string` Signed buying-power correction from open orders. - `SettledCash string` The amount of cash that is settled and available for withdrawal or trading. - `Sod AccountBalancesSod` Start-of-day snapshot balances. - `BuyingPower string` Start-of-day buying power. - `Equity string` Start-of-day equity. - `LongMarketValue string` Start-of-day long market value. - `ShortMarketValue string` Start-of-day short market value. - `Asof Time` Timestamp for the start-of-day values. - `DayTradeBuyingPower string` Start-of-day day-trade buying power. - `MaintenanceMarginExcess string` Start-of-day maintenance margin excess. - `MaintenanceMarginRequirement string` Start-of-day maintenance margin requirement. - `TradeCash string` Start-of-day trade cash. - `TradeCash string` Trade-date effective cash. - `UnsettledCredits string` Trade-date unsettled cash credits. - `UnsettledDebits string` Trade-date unsettled cash debits. - `WithdrawableCash string` The amount of cash currently available to withdraw. - `MarginDetails MarginDetails` Margin-account-only details. - `DayTradeCount int64` The number of day trades executed over the 5 most recent trading days. - `InitialMarginExcess string` Initial margin excess for trade-date balances. - `InitialMarginRequirement string` Initial margin requirement for trade-date balances. - `MaintenanceMarginExcess string` Maintenance margin excess for trade-date balances. - `MaintenanceMarginRequirement string` Maintenance margin requirement for trade-date balances. - `PatternDayTrader bool` `true` if the account is currently flagged as a PDT, otherwise `false`. - `DayTradeBuyingPowerUsage string` The amount of day-trade buying power used during the current trading day. - `TopContributors []MarginTopContributor` Optional top margin contributors, returned only when explicitly requested. - `DayTradeBuyingPowerUsage string` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `InitialMarginRequirement string` Initial margin requirement attributable to this underlying. - `MaintenanceMarginRequirement string` Maintenance margin requirement attributable to this underlying. - `MarketValue string` Net market value attributable to this underlying. - `UnderlyingInstrumentID string` UUID of the underlying security contributing to margin requirement. - `Usage MarginDetailsUsage` Current usage totals. - `Total string` The total margin available in the current model. - `Used string` The amount of margin that is currently being utilized. - `Multiplier string` Applied multiplier for margin calculations. - `ShortMarketValue string` The total market value of all short positions. ### Account Balances Sod - `type AccountBalancesSod struct{…}` - `BuyingPower string` Start-of-day buying power. - `Equity string` Start-of-day equity. - `LongMarketValue string` Start-of-day long market value. - `ShortMarketValue string` Start-of-day short market value. - `Asof Time` Timestamp for the start-of-day values. - `DayTradeBuyingPower string` Start-of-day day-trade buying power. - `MaintenanceMarginExcess string` Start-of-day maintenance margin excess. - `MaintenanceMarginRequirement string` Start-of-day maintenance margin requirement. - `TradeCash string` Start-of-day trade cash. ### Account List - `type AccountList []Account` - `ID int64` The unique identifier for the account - `AccountHolderEntityID int64` The account holder entity identifier - `FullName string` The full legal name of the account - `OpenDate Time` The date the account was opened - `OptionsLevel int64` The options level of the account - `ShortName string` The short name of the account - `Status AccountStatus` The current status of the account - `const AccountStatusActive AccountStatus = "ACTIVE"` - `const AccountStatusInactive AccountStatus = "INACTIVE"` - `const AccountStatusClosed AccountStatus = "CLOSED"` - `Subtype AccountSubtype` The sub-type of account - `const AccountSubtypeCash AccountSubtype = "CASH"` - `const AccountSubtypeMargin AccountSubtype = "MARGIN"` - `const AccountSubtypeOther AccountSubtype = "OTHER"` - `Type AccountType` The type of account - `const AccountTypeCustomer AccountType = "CUSTOMER"` - `const AccountTypeOther AccountType = "OTHER"` - `CloseDate Time` The date the account was closed, if applicable ### Account Settings - `type AccountSettings struct{…}` - `Risk RiskSettings` Risk settings for the account - `MaxNotional string` The maximum notional value available to the account ### Account Status - `type AccountStatus string` Account status - `const AccountStatusActive AccountStatus = "ACTIVE"` - `const AccountStatusInactive AccountStatus = "INACTIVE"` - `const AccountStatusClosed AccountStatus = "CLOSED"` ### Account Subtype - `type AccountSubtype string` Account subtype classification providing more granular categorization - `const AccountSubtypeCash AccountSubtype = "CASH"` - `const AccountSubtypeMargin AccountSubtype = "MARGIN"` - `const AccountSubtypeOther AccountSubtype = "OTHER"` ### Account Type - `type AccountType string` Account type classification - `const AccountTypeCustomer AccountType = "CUSTOMER"` - `const AccountTypeOther AccountType = "OTHER"` ### Margin Details - `type MarginDetails struct{…}` - `DayTradeCount int64` The number of day trades executed over the 5 most recent trading days. - `InitialMarginExcess string` Initial margin excess for trade-date balances. - `InitialMarginRequirement string` Initial margin requirement for trade-date balances. - `MaintenanceMarginExcess string` Maintenance margin excess for trade-date balances. - `MaintenanceMarginRequirement string` Maintenance margin requirement for trade-date balances. - `PatternDayTrader bool` `true` if the account is currently flagged as a PDT, otherwise `false`. - `DayTradeBuyingPowerUsage string` The amount of day-trade buying power used during the current trading day. - `TopContributors []MarginTopContributor` Optional top margin contributors, returned only when explicitly requested. - `DayTradeBuyingPowerUsage string` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `InitialMarginRequirement string` Initial margin requirement attributable to this underlying. - `MaintenanceMarginRequirement string` Maintenance margin requirement attributable to this underlying. - `MarketValue string` Net market value attributable to this underlying. - `UnderlyingInstrumentID string` UUID of the underlying security contributing to margin requirement. - `Usage MarginDetailsUsage` Current usage totals. - `Total string` The total margin available in the current model. - `Used string` The amount of margin that is currently being utilized. ### Margin Details Usage - `type MarginDetailsUsage struct{…}` - `Total string` The total margin available in the current model. - `Used string` The amount of margin that is currently being utilized. ### Margin Top Contributor - `type MarginTopContributor struct{…}` - `DayTradeBuyingPowerUsage string` Day-trade buying power consumed by fills against this underlying on the current trade date. Populated only for pattern day trader accounts. - `InitialMarginRequirement string` Initial margin requirement attributable to this underlying. - `MaintenanceMarginRequirement string` Maintenance margin requirement attributable to this underlying. - `MarketValue string` Net market value attributable to this underlying. - `UnderlyingInstrumentID string` UUID of the underlying security contributing to margin requirement. ### Margin Type - `type MarginType string` An account's margin type - `const MarginTypeOther MarginType = "OTHER"` - `const MarginTypeNone MarginType = "NONE"` - `const MarginTypePortfolioMargin MarginType = "PORTFOLIO_MARGIN"` - `const MarginTypeRiskBasedHaircutBrokerDealer MarginType = "RISK_BASED_HAIRCUT_BROKER_DEALER"` - `const MarginTypeRegT MarginType = "REG_T"` - `const MarginTypeRiskBasedHaircutMarketMaker MarginType = "RISK_BASED_HAIRCUT_MARKET_MAKER"` - `const MarginTypeCiro MarginType = "CIRO"` - `const MarginTypeFuturesNlv MarginType = "FUTURES_NLV"` - `const MarginTypeFuturesTotEq MarginType = "FUTURES_TOT_EQ"` ### Portfolio History Response - `type PortfolioHistoryResponse struct{…}` - `Segments []PortfolioHistorySegment` - `Date Time` The date for this segment - `EodEquity string` The equity at the end of the trading day. - `RealizedPnl string` Sum of the profit and loss realized from position closing trading activity. - `SodEquity string` The equity at the start of the trading day. - `UnrealizedPnl string` Sum of the profit and loss from market changes. - `BoughtNotional string` Amount bought MTM - `DayPnl string` Sum of the profit and loss from intraday trading activities for the trading day. - `NetPnl string` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `PositionPnl string` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `SoldNotional string` Amount sold MTM ### Portfolio History Segment - `type PortfolioHistorySegment struct{…}` - `Date Time` The date for this segment - `EodEquity string` The equity at the end of the trading day. - `RealizedPnl string` Sum of the profit and loss realized from position closing trading activity. - `SodEquity string` The equity at the start of the trading day. - `UnrealizedPnl string` Sum of the profit and loss from market changes. - `BoughtNotional string` Amount bought MTM - `DayPnl string` Sum of the profit and loss from intraday trading activities for the trading day. - `NetPnl string` P&L after netting all realized and unrealized P&L, adjustments, dividends, change in accruals, income and expenses - `PositionPnl string` P&L attributable to start-of-day (carried) positions from market movement during this trading day. - `SoldNotional string` Amount sold MTM ### Risk Settings - `type RiskSettings struct{…}` Risk settings for an account - `MaxNotional string` The maximum notional value available to the account # API Version ## Get the API version. `client.V1.APIVersion.GetVersion(ctx) (*V1APIVersionGetVersionResponse, error)` **get** `/v1/version` Returns the current version string for this API endpoint. ### Returns - `type V1APIVersionGetVersionResponse struct{…}` - `Data Version` API version information - `Version string` API version string ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.APIVersion.GetVersion(context.TODO()) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": { "version": "2025-10-31" }, "error": null, "metadata": { "request_id": "2c3d4e5f-6a7b-8c9d-0e1f-2a3b4c5d6e7f" } } ``` ## Domain Types ### Version - `type Version struct{…}` API version information - `Version string` API version string # Calendar ## Get Clock `client.V1.Calendar.GetClock(ctx) (*V1CalendarGetClockResponse, error)` **get** `/v1/clock` Returns the current server time in UTC. ### Returns - `type V1CalendarGetClockResponse struct{…}` - `Data ClockDetail` Current server time and market clock information - `Clock Time` Current server time in UTC ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Calendar.GetClock(context.TODO()) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": { "clock": "2025-03-01T03:35:00.000000000Z" }, "error": null, "metadata": { "request_id": "1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e" } } ``` ## Get Market Hours Calendar. `client.V1.Calendar.GetMarketHoursCalendar(ctx, query) (*V1CalendarGetMarketHoursCalendarResponse, error)` **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 - `query V1CalendarGetMarketHoursCalendarParams` - `Date param.Field[string]` The date to query market hours for (YYYY-MM-DD). Defaults to today. - `Market param.Field[MarketType]` Market type to query (us_equities, us_options). If omitted, returns all markets. ### Returns - `type V1CalendarGetMarketHoursCalendarResponse struct{…}` - `Data MarketHoursDetailList` - `CurrentTime Time` Current time in market timezone with offset - `Date Time` The date for which market hours are provided - `Market MarketType` Market type identifier - `const MarketTypeUsEquities MarketType = "us_equities"` - `const MarketTypeUsOptions MarketType = "us_options"` - `MarketName string` Human-readable market name - `NextSessions TradingSessions` Next trading day's session schedules (without time_until fields) - `AfterHours SessionSchedule` After-hours session schedule, null if not available - `Close Time` Session close timestamp with timezone offset - `Open Time` Session open timestamp with timezone offset - `TimeUntilClose string` ISO 8601 duration until session closes. Null if session is not currently open. - `TimeUntilOpen string` ISO 8601 duration until session opens. Null if session has already started or closed. - `PreMarket SessionSchedule` Pre-market session schedule, null if not available - `Regular SessionSchedule` Regular trading session schedule, null if holiday/weekend - `Status MarketStatus` Market status information - `DayType DayType` The type of trading day - `const DayTypeTradingDay DayType = "TRADING_DAY"` - `const DayTypeEarlyClose DayType = "EARLY_CLOSE"` - `const DayTypeHoliday DayType = "HOLIDAY"` - `const DayTypeWeekend DayType = "WEEKEND"` - `IsOpen bool` Whether the market is currently open (real-time) - `CurrentSession MarketSessionType` Current session type if market is open, null if closed - `const MarketSessionTypePreMarket MarketSessionType = "pre_market"` - `const MarketSessionTypeRegular MarketSessionType = "regular"` - `const MarketSessionTypeAfterHours MarketSessionType = "after_hours"` - `Timezone string` IANA timezone identifier for the market - `TodaySessions TradingSessions` Trading session schedules for the requested date with time_until fields ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Calendar.GetMarketHoursCalendar(context.TODO(), clearstreet.V1CalendarGetMarketHoursCalendarParams{ Date: "date", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type ClockDetail struct{…}` Current server time and market clock information - `Clock Time` Current server time in UTC ### Day Type - `type DayType string` Day type for market hours - indicates the type of trading day - `const DayTypeTradingDay DayType = "TRADING_DAY"` - `const DayTypeEarlyClose DayType = "EARLY_CLOSE"` - `const DayTypeHoliday DayType = "HOLIDAY"` - `const DayTypeWeekend DayType = "WEEKEND"` ### Market Hours Detail - `type MarketHoursDetail struct{…}` Comprehensive market hours information for a specific market and date - `CurrentTime Time` Current time in market timezone with offset - `Date Time` The date for which market hours are provided - `Market MarketType` Market type identifier - `const MarketTypeUsEquities MarketType = "us_equities"` - `const MarketTypeUsOptions MarketType = "us_options"` - `MarketName string` Human-readable market name - `NextSessions TradingSessions` Next trading day's session schedules (without time_until fields) - `AfterHours SessionSchedule` After-hours session schedule, null if not available - `Close Time` Session close timestamp with timezone offset - `Open Time` Session open timestamp with timezone offset - `TimeUntilClose string` ISO 8601 duration until session closes. Null if session is not currently open. - `TimeUntilOpen string` ISO 8601 duration until session opens. Null if session has already started or closed. - `PreMarket SessionSchedule` Pre-market session schedule, null if not available - `Regular SessionSchedule` Regular trading session schedule, null if holiday/weekend - `Status MarketStatus` Market status information - `DayType DayType` The type of trading day - `const DayTypeTradingDay DayType = "TRADING_DAY"` - `const DayTypeEarlyClose DayType = "EARLY_CLOSE"` - `const DayTypeHoliday DayType = "HOLIDAY"` - `const DayTypeWeekend DayType = "WEEKEND"` - `IsOpen bool` Whether the market is currently open (real-time) - `CurrentSession MarketSessionType` Current session type if market is open, null if closed - `const MarketSessionTypePreMarket MarketSessionType = "pre_market"` - `const MarketSessionTypeRegular MarketSessionType = "regular"` - `const MarketSessionTypeAfterHours MarketSessionType = "after_hours"` - `Timezone string` IANA timezone identifier for the market - `TodaySessions TradingSessions` Trading session schedules for the requested date with time_until fields ### Market Hours Detail List - `type MarketHoursDetailList []MarketHoursDetail` - `CurrentTime Time` Current time in market timezone with offset - `Date Time` The date for which market hours are provided - `Market MarketType` Market type identifier - `const MarketTypeUsEquities MarketType = "us_equities"` - `const MarketTypeUsOptions MarketType = "us_options"` - `MarketName string` Human-readable market name - `NextSessions TradingSessions` Next trading day's session schedules (without time_until fields) - `AfterHours SessionSchedule` After-hours session schedule, null if not available - `Close Time` Session close timestamp with timezone offset - `Open Time` Session open timestamp with timezone offset - `TimeUntilClose string` ISO 8601 duration until session closes. Null if session is not currently open. - `TimeUntilOpen string` ISO 8601 duration until session opens. Null if session has already started or closed. - `PreMarket SessionSchedule` Pre-market session schedule, null if not available - `Regular SessionSchedule` Regular trading session schedule, null if holiday/weekend - `Status MarketStatus` Market status information - `DayType DayType` The type of trading day - `const DayTypeTradingDay DayType = "TRADING_DAY"` - `const DayTypeEarlyClose DayType = "EARLY_CLOSE"` - `const DayTypeHoliday DayType = "HOLIDAY"` - `const DayTypeWeekend DayType = "WEEKEND"` - `IsOpen bool` Whether the market is currently open (real-time) - `CurrentSession MarketSessionType` Current session type if market is open, null if closed - `const MarketSessionTypePreMarket MarketSessionType = "pre_market"` - `const MarketSessionTypeRegular MarketSessionType = "regular"` - `const MarketSessionTypeAfterHours MarketSessionType = "after_hours"` - `Timezone string` IANA timezone identifier for the market - `TodaySessions TradingSessions` Trading session schedules for the requested date with time_until fields ### Market Session Type - `type MarketSessionType string` Session type for market hours - `const MarketSessionTypePreMarket MarketSessionType = "pre_market"` - `const MarketSessionTypeRegular MarketSessionType = "regular"` - `const MarketSessionTypeAfterHours MarketSessionType = "after_hours"` ### Market Status - `type MarketStatus struct{…}` Market status information - `DayType DayType` The type of trading day - `const DayTypeTradingDay DayType = "TRADING_DAY"` - `const DayTypeEarlyClose DayType = "EARLY_CLOSE"` - `const DayTypeHoliday DayType = "HOLIDAY"` - `const DayTypeWeekend DayType = "WEEKEND"` - `IsOpen bool` Whether the market is currently open (real-time) - `CurrentSession MarketSessionType` Current session type if market is open, null if closed - `const MarketSessionTypePreMarket MarketSessionType = "pre_market"` - `const MarketSessionTypeRegular MarketSessionType = "regular"` - `const MarketSessionTypeAfterHours MarketSessionType = "after_hours"` ### Market Type - `type MarketType string` Market type for market hours calendar endpoint - `const MarketTypeUsEquities MarketType = "us_equities"` - `const MarketTypeUsOptions MarketType = "us_options"` ### Session Schedule - `type SessionSchedule struct{…}` Session schedule with open and close timestamps - `Close Time` Session close timestamp with timezone offset - `Open Time` Session open timestamp with timezone offset - `TimeUntilClose string` ISO 8601 duration until session closes. Null if session is not currently open. - `TimeUntilOpen string` ISO 8601 duration until session opens. Null if session has already started or closed. ### Trading Sessions - `type TradingSessions struct{…}` Trading sessions for a market day with full timestamps - `AfterHours SessionSchedule` After-hours session schedule, null if not available - `Close Time` Session close timestamp with timezone offset - `Open Time` Session open timestamp with timezone offset - `TimeUntilClose string` ISO 8601 duration until session closes. Null if session is not currently open. - `TimeUntilOpen string` ISO 8601 duration until session opens. Null if session has already started or closed. - `PreMarket SessionSchedule` Pre-market session schedule, null if not available - `Regular SessionSchedule` Regular trading session schedule, null if holiday/weekend # Instrument Data ## Get All Instrument Events `client.V1.InstrumentData.GetAllInstrumentEvents(ctx, query) (*V1InstrumentDataGetAllInstrumentEventsResponse, error)` **get** `/v1/instruments/events` List instrument events across all securities. Retrieves all instrument events grouped by date. ### Parameters - `query V1InstrumentDataGetAllInstrumentEventsParams` - `EventTypes param.Field[[]AllEventsEventType]` Filter by event type(s). Comma-delimited list. Example: `event_types=EARNINGS,IPO`. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` - `FromDate param.Field[string]` The start date for the query range, inclusive (YYYY-MM-DD). - `InstrumentIDs param.Field[[]string]` Filter by OEMS instrument ID(s). Comma-delimited list of UUIDs. Example: `instrument_ids=550e8400-e29b-41d4-a716-446655440000`. - `ToDate param.Field[string]` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `type V1InstrumentDataGetAllInstrumentEventsResponse struct{…}` - `Data InstrumentAllEventsData` All-events payload grouped by date. - `EventDates []InstrumentEventsByDate` Events grouped by date in descending order. - `Date Time` Event date. - `Events []InstrumentEventEnvelope` Flat event envelopes for this date. - `Symbol string` Symbol associated with the event. - `Type AllEventsEventType` Event type discriminator. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` - `DividendEventData InstrumentDividendEvent` Dividend payload when type is DIVIDEND. - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `EarningsEventData InstrumentEarnings` Earnings payload when type is EARNINGS. - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument identifier, when the instrument is found in the instrument cache. - `IpoEventData InstrumentEventIpoItem` IPO payload when type is IPO. - `Actions string` IPO action. - `AnnouncedAt Time` IPO announced timestamp. - `Company string` IPO company name. - `Exchange string` IPO exchange. - `MarketCap string` IPO market cap. - `PriceRange string` IPO price range. - `Shares string` IPO shares offered. - `Name string` Instrument name associated with the event, when available. - `ReportingCurrency string` The currency used for reporting financial data. - `StockSplitEventData InstrumentSplitEvent` Stock split payload when type is STOCK_SPLIT. - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetAllInstrumentEvents(context.TODO(), clearstreet.V1InstrumentDataGetAllInstrumentEventsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentEvents(ctx, instrumentID, query) (*V1InstrumentDataGetInstrumentEventsResponse, error)` **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 - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentDataGetInstrumentEventsParams` - `FromDate param.Field[string]` The start date for the query range, inclusive (YYYY-MM-DD). - `ToDate param.Field[string]` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `type V1InstrumentDataGetInstrumentEventsResponse struct{…}` - `Data InstrumentEventsData` Grouped instrument events by type - `Dividends []InstrumentDividendEvent` Dividend distribution events - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `Earnings []InstrumentEarnings` Earnings announcement events - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument UUID from the request - `Splits []InstrumentSplitEvent` Stock split events - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") - `ReportingCurrency string` The currency used for reporting financial data ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentEvents( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentDataGetInstrumentEventsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentFundamentals(ctx, instrumentID) (*V1InstrumentDataGetInstrumentFundamentalsResponse, error)` **get** `/v1/instruments/{instrument_id}/fundamentals` Retrieves supplemental fundamentals and company profile data for an instrument. ### Parameters - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID ### Returns - `type V1InstrumentDataGetInstrumentFundamentalsResponse struct{…}` - `Data InstrumentFundamentals` Supplemental fundamentals and company profile data for an instrument. - `AverageVolume int64` The average daily trading volume over the past 30 days - `Beta string` The beta value, measuring the instrument's volatility relative to the overall market - `Description string` A detailed description of the instrument or company - `DividendYield string` The trailing twelve months (TTM) dividend yield - `EarningsPerShare string` The trailing twelve months (TTM) earnings per share - `FiftyTwoWeekHigh string` The highest price over the last 52 weeks - `FiftyTwoWeekLow string` The lowest price over the last 52 weeks - `Industry string` The specific industry of the instrument's issuer - `ListDate Time` The date the instrument was first listed - `LogoURL string` URL to a representative logo image for the instrument or issuer - `MarketCap string` The total market capitalization - `PreviousClose string` The closing price from the previous trading day - `PriceToEarnings string` The price-to-earnings (P/E) ratio for the trailing twelve months (TTM) - `ReportingCurrency string` The currency used for reporting financial data - `Sector string` The business sector of the instrument's issuer ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentFundamentals(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentBalanceSheetStatements(ctx, instrumentID, query) (*V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse, error)` **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 - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentDataGetInstrumentBalanceSheetStatementsParams` - `FromDate param.Field[string]` The start date for the query range, inclusive (YYYY-MM-DD). - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `ToDate param.Field[string]` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `type V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse struct{…}` - `Data InstrumentBalanceSheetStatementList` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountPayables string` Account payables - `AccountsReceivables string` Accounts receivables - `AccruedExpenses string` Accrued expenses - `AccumulatedOtherComprehensiveIncomeLoss string` Accumulated other comprehensive income/loss - `AdditionalPaidInCapital string` Additional paid-in capital - `CapitalLeaseObligations string` Capital lease obligations (total) - `CapitalLeaseObligationsCurrent string` Capital lease obligations (current portion) - `CashAndCashEquivalents string` Cash and cash equivalents - `CashAndShortTermInvestments string` Cash and short-term investments combined - `CommonStock string` Common stock - `DeferredRevenue string` Deferred revenue - `DeferredRevenueNonCurrent string` Deferred revenue (non-current) - `DeferredTaxLiabilitiesNonCurrent string` Deferred tax liabilities (non-current) - `Goodwill string` Goodwill - `GoodwillAndIntangibleAssets string` Goodwill and intangible assets combined - `IntangibleAssets string` Intangible assets - `Inventory string` Inventory - `LongTermDebt string` Long-term debt - `LongTermInvestments string` Long-term investments - `MinorityInterest string` Minority interest - `NetDebt string` Net debt (total debt minus cash) - `NetReceivables string` Net receivables - `OtherAssets string` Other assets - `OtherCurrentAssets string` Other current assets - `OtherCurrentLiabilities string` Other current liabilities - `OtherLiabilities string` Other liabilities - `OtherNonCurrentAssets string` Other non-current assets - `OtherNonCurrentLiabilities string` Other non-current liabilities - `OtherPayables string` Other payables - `OtherReceivables string` Other receivables - `OtherTotalStockholdersEquity string` Other total stockholders equity - `PreferredStock string` Preferred stock - `Prepaids string` Prepaids - `PropertyPlantAndEquipmentNet string` Property, plant and equipment net of depreciation - `RetainedEarnings string` Retained earnings - `ShortTermDebt string` Short-term debt - `ShortTermInvestments string` Short-term investments - `TaxAssets string` Tax assets - `TaxPayables string` Tax payables - `TotalAssets string` Total assets - `TotalCurrentAssets string` Total current assets - `TotalCurrentLiabilities string` Total current liabilities - `TotalDebt string` Total debt - `TotalEquity string` Total equity - `TotalInvestments string` Total investments - `TotalLiabilities string` Total liabilities - `TotalLiabilitiesAndTotalEquity string` Total liabilities and total equity - `TotalNonCurrentAssets string` Total non-current assets - `TotalNonCurrentLiabilities string` Total non-current liabilities - `TotalPayables string` Total payables - `TotalStockholdersEquity string` Total stockholders equity - `TreasuryStock string` Treasury stock ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentBalanceSheetStatements( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentDataGetInstrumentBalanceSheetStatementsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentIncomeStatements(ctx, instrumentID, query) (*V1InstrumentDataGetInstrumentIncomeStatementsResponse, error)` **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 - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentDataGetInstrumentIncomeStatementsParams` - `FromDate param.Field[string]` The start date for the query range, inclusive (YYYY-MM-DD). - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `ToDate param.Field[string]` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `type V1InstrumentDataGetInstrumentIncomeStatementsResponse struct{…}` - `Data InstrumentIncomeStatementList` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `BottomLineNetIncome string` Bottom line net income after all adjustments - `CostAndExpenses string` Total costs and expenses - `CostOfRevenue string` Direct costs attributable to producing goods sold - `DepreciationAndAmortization string` Depreciation and amortization expenses - `Ebit string` Earnings before interest and taxes - `Ebitda string` Earnings before interest, taxes, depreciation, and amortization - `Eps string` Basic earnings per share - `EpsDiluted string` Diluted earnings per share - `GeneralAndAdministrativeExpenses string` General administrative overhead expenses - `GrossProfit string` Revenue minus cost of revenue - `IncomeBeforeTax string` Income before income tax expense - `IncomeTaxExpense string` Income tax expense for the period - `InterestExpense string` Interest paid on debt - `InterestIncome string` Interest earned on investments and cash - `NetIncome string` Total net income for the period - `NetIncomeDeductions string` Deductions from net income - `NetIncomeFromContinuingOperations string` Net income from continuing operations - `NetIncomeFromDiscontinuedOperations string` Net income from discontinued operations - `NetInterestIncome string` Net interest income (interest income minus interest expense) - `NonOperatingIncomeExcludingInterest string` Non-operating income excluding interest - `OperatingExpenses string` Total operating expenses - `OperatingIncome string` Income from core business operations - `OtherAdjustmentsToNetIncome string` Other adjustments to net income - `OtherExpenses string` Other miscellaneous expenses - `ResearchAndDevelopmentExpenses string` Expenditure on research and development activities - `Revenue string` Total revenue from sales of goods and services - `SellingAndMarketingExpenses string` Expenditure on marketing and sales activities - `SellingGeneralAndAdministrativeExpenses string` Combined selling, general, and administrative expenses - `TotalOtherIncomeExpensesNet string` Net of other income and expenses - `WeightedAverageShsOut string` Weighted average shares outstanding (basic) - `WeightedAverageShsOutDil string` Weighted average shares outstanding (diluted) ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentIncomeStatements( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentDataGetInstrumentIncomeStatementsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentAnalystConsensus(ctx, instrumentID, query) (*V1InstrumentDataGetInstrumentAnalystConsensusResponse, error)` **get** `/v1/instruments/{instrument_id}/analyst-reporting` Retrieves analyst ratings and price targets for an instrument. ### Parameters - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentDataGetInstrumentAnalystConsensusParams` - `From param.Field[Time]` The start date for the query range, inclusive (YYYY-MM-DD) - `To param.Field[Time]` The end date for the query range, inclusive (YYYY-MM-DD) ### Returns - `type V1InstrumentDataGetInstrumentAnalystConsensusResponse struct{…}` - `Data InstrumentAnalystConsensus` Aggregated analyst consensus metrics - `Date Time` The date the consensus snapshot was generated - `Distribution AnalystDistribution` Count of individual analyst recommendations by category - `Buy int64` Number of buy recommendations - `Hold int64` Number of hold recommendations - `Sell int64` Number of sell recommendations - `StrongBuy int64` Number of strong buy recommendations - `StrongSell int64` Number of strong sell recommendations - `PriceTarget PriceTarget` Aggregated analyst price target statistics - `Average string` Average analyst price target - `Currency string` ISO 4217 currency code of the price targets - `High string` Highest analyst price target - `Low string` Lowest analyst price target - `Rating AnalystRating` Consensus analyst rating - `const AnalystRatingStrongBuy AnalystRating = "STRONG_BUY"` - `const AnalystRatingBuy AnalystRating = "BUY"` - `const AnalystRatingHold AnalystRating = "HOLD"` - `const AnalystRatingSell AnalystRating = "SELL"` - `const AnalystRatingStrongSell AnalystRating = "STRONG_SELL"` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentAnalystConsensus( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentDataGetInstrumentAnalystConsensusParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.GetInstrumentCashFlowStatements(ctx, instrumentID, query) (*V1InstrumentDataGetInstrumentCashFlowStatementsResponse, error)` **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 - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentDataGetInstrumentCashFlowStatementsParams` - `FromDate param.Field[string]` The start date for the query range, inclusive (YYYY-MM-DD). - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `ToDate param.Field[string]` The end date for the query range, inclusive (YYYY-MM-DD). ### Returns - `type V1InstrumentDataGetInstrumentCashFlowStatementsResponse struct{…}` - `Data InstrumentCashFlowStatementList` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountsPayables string` Change in accounts payables - `AccountsReceivables string` Change in accounts receivables - `AcquisitionsNet string` Net acquisitions - `CapitalExpenditure string` Capital expenditure - `CashAtBeginningOfPeriod string` Cash and cash equivalents at beginning of period - `CashAtEndOfPeriod string` Cash and cash equivalents at end of period - `ChangeInWorkingCapital string` Change in working capital - `CommonDividendsPaid string` Common dividends paid - `CommonStockIssuance string` Common stock issuance - `CommonStockRepurchased string` Common stock repurchased (buybacks) - `DeferredIncomeTax string` Deferred income tax expense - `DepreciationAndAmortization string` Depreciation and amortization expense - `EffectOfForexChangesOnCash string` Effect of foreign exchange changes on cash - `FreeCashFlow string` Free cash flow (operating cash flow minus capital expenditure) - `IncomeTaxesPaid string` Income taxes paid - `InterestPaid string` Interest paid - `Inventory string` Change in inventory - `InvestmentsInPropertyPlantAndEquipment string` Investments in property, plant, and equipment - `LongTermNetDebtIssuance string` Long-term net debt issuance - `NetCashProvidedByFinancingActivities string` Net cash provided by financing activities - `NetCashProvidedByInvestingActivities string` Net cash provided by investing activities - `NetCashProvidedByOperatingActivities string` Net cash provided by operating activities - `NetChangeInCash string` Net change in cash during the period - `NetCommonStockIssuance string` Net common stock issuance - `NetDebtIssuance string` Net debt issuance (long-term + short-term) - `NetDividendsPaid string` Net dividends paid (common + preferred) - `NetIncome string` Net income for the period - `NetPreferredStockIssuance string` Net preferred stock issuance - `NetStockIssuance string` Net stock issuance (common + preferred) - `OperatingCashFlow string` Operating cash flow (alternative calculation) - `OtherFinancingActivities string` Other financing activities - `OtherInvestingActivities string` Other investing activities - `OtherNonCashItems string` Other non-cash items - `OtherWorkingCapital string` Change in other working capital - `PreferredDividendsPaid string` Preferred dividends paid - `PurchasesOfInvestments string` Purchases of investments - `SalesMaturitiesOfInvestments string` Sales and maturities of investments - `ShortTermNetDebtIssuance string` Short-term net debt issuance - `StockBasedCompensation string` Stock-based compensation expense ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.GetInstrumentCashFlowStatements( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentDataGetInstrumentCashFlowStatementsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type AllEventsEventType string` Event types supported by the all-events endpoint. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` ### Analyst Distribution - `type AnalystDistribution struct{…}` Analyst recommendation distribution - `Buy int64` Number of buy recommendations - `Hold int64` Number of hold recommendations - `Sell int64` Number of sell recommendations - `StrongBuy int64` Number of strong buy recommendations - `StrongSell int64` Number of strong sell recommendations ### Analyst Rating - `type AnalystRating string` Analyst rating category - `const AnalystRatingStrongBuy AnalystRating = "STRONG_BUY"` - `const AnalystRatingBuy AnalystRating = "BUY"` - `const AnalystRatingHold AnalystRating = "HOLD"` - `const AnalystRatingSell AnalystRating = "SELL"` - `const AnalystRatingStrongSell AnalystRating = "STRONG_SELL"` ### Fiscal Period Type - `type FiscalPeriodType string` Fiscal period type for earnings reports - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` ### Instrument All Events Data - `type InstrumentAllEventsData struct{…}` All-events payload grouped by date. - `EventDates []InstrumentEventsByDate` Events grouped by date in descending order. - `Date Time` Event date. - `Events []InstrumentEventEnvelope` Flat event envelopes for this date. - `Symbol string` Symbol associated with the event. - `Type AllEventsEventType` Event type discriminator. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` - `DividendEventData InstrumentDividendEvent` Dividend payload when type is DIVIDEND. - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `EarningsEventData InstrumentEarnings` Earnings payload when type is EARNINGS. - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument identifier, when the instrument is found in the instrument cache. - `IpoEventData InstrumentEventIpoItem` IPO payload when type is IPO. - `Actions string` IPO action. - `AnnouncedAt Time` IPO announced timestamp. - `Company string` IPO company name. - `Exchange string` IPO exchange. - `MarketCap string` IPO market cap. - `PriceRange string` IPO price range. - `Shares string` IPO shares offered. - `Name string` Instrument name associated with the event, when available. - `ReportingCurrency string` The currency used for reporting financial data. - `StockSplitEventData InstrumentSplitEvent` Stock split payload when type is STOCK_SPLIT. - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Analyst Consensus - `type InstrumentAnalystConsensus struct{…}` Aggregated analyst consensus metrics - `Date Time` The date the consensus snapshot was generated - `Distribution AnalystDistribution` Count of individual analyst recommendations by category - `Buy int64` Number of buy recommendations - `Hold int64` Number of hold recommendations - `Sell int64` Number of sell recommendations - `StrongBuy int64` Number of strong buy recommendations - `StrongSell int64` Number of strong sell recommendations - `PriceTarget PriceTarget` Aggregated analyst price target statistics - `Average string` Average analyst price target - `Currency string` ISO 4217 currency code of the price targets - `High string` Highest analyst price target - `Low string` Lowest analyst price target - `Rating AnalystRating` Consensus analyst rating - `const AnalystRatingStrongBuy AnalystRating = "STRONG_BUY"` - `const AnalystRatingBuy AnalystRating = "BUY"` - `const AnalystRatingHold AnalystRating = "HOLD"` - `const AnalystRatingSell AnalystRating = "SELL"` - `const AnalystRatingStrongSell AnalystRating = "STRONG_SELL"` ### Instrument Balance Sheet Statement - `type InstrumentBalanceSheetStatement struct{…}` A quarterly balance sheet statement for an instrument. - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountPayables string` Account payables - `AccountsReceivables string` Accounts receivables - `AccruedExpenses string` Accrued expenses - `AccumulatedOtherComprehensiveIncomeLoss string` Accumulated other comprehensive income/loss - `AdditionalPaidInCapital string` Additional paid-in capital - `CapitalLeaseObligations string` Capital lease obligations (total) - `CapitalLeaseObligationsCurrent string` Capital lease obligations (current portion) - `CashAndCashEquivalents string` Cash and cash equivalents - `CashAndShortTermInvestments string` Cash and short-term investments combined - `CommonStock string` Common stock - `DeferredRevenue string` Deferred revenue - `DeferredRevenueNonCurrent string` Deferred revenue (non-current) - `DeferredTaxLiabilitiesNonCurrent string` Deferred tax liabilities (non-current) - `Goodwill string` Goodwill - `GoodwillAndIntangibleAssets string` Goodwill and intangible assets combined - `IntangibleAssets string` Intangible assets - `Inventory string` Inventory - `LongTermDebt string` Long-term debt - `LongTermInvestments string` Long-term investments - `MinorityInterest string` Minority interest - `NetDebt string` Net debt (total debt minus cash) - `NetReceivables string` Net receivables - `OtherAssets string` Other assets - `OtherCurrentAssets string` Other current assets - `OtherCurrentLiabilities string` Other current liabilities - `OtherLiabilities string` Other liabilities - `OtherNonCurrentAssets string` Other non-current assets - `OtherNonCurrentLiabilities string` Other non-current liabilities - `OtherPayables string` Other payables - `OtherReceivables string` Other receivables - `OtherTotalStockholdersEquity string` Other total stockholders equity - `PreferredStock string` Preferred stock - `Prepaids string` Prepaids - `PropertyPlantAndEquipmentNet string` Property, plant and equipment net of depreciation - `RetainedEarnings string` Retained earnings - `ShortTermDebt string` Short-term debt - `ShortTermInvestments string` Short-term investments - `TaxAssets string` Tax assets - `TaxPayables string` Tax payables - `TotalAssets string` Total assets - `TotalCurrentAssets string` Total current assets - `TotalCurrentLiabilities string` Total current liabilities - `TotalDebt string` Total debt - `TotalEquity string` Total equity - `TotalInvestments string` Total investments - `TotalLiabilities string` Total liabilities - `TotalLiabilitiesAndTotalEquity string` Total liabilities and total equity - `TotalNonCurrentAssets string` Total non-current assets - `TotalNonCurrentLiabilities string` Total non-current liabilities - `TotalPayables string` Total payables - `TotalStockholdersEquity string` Total stockholders equity - `TreasuryStock string` Treasury stock ### Instrument Balance Sheet Statement List - `type InstrumentBalanceSheetStatementList []InstrumentBalanceSheetStatement` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountPayables string` Account payables - `AccountsReceivables string` Accounts receivables - `AccruedExpenses string` Accrued expenses - `AccumulatedOtherComprehensiveIncomeLoss string` Accumulated other comprehensive income/loss - `AdditionalPaidInCapital string` Additional paid-in capital - `CapitalLeaseObligations string` Capital lease obligations (total) - `CapitalLeaseObligationsCurrent string` Capital lease obligations (current portion) - `CashAndCashEquivalents string` Cash and cash equivalents - `CashAndShortTermInvestments string` Cash and short-term investments combined - `CommonStock string` Common stock - `DeferredRevenue string` Deferred revenue - `DeferredRevenueNonCurrent string` Deferred revenue (non-current) - `DeferredTaxLiabilitiesNonCurrent string` Deferred tax liabilities (non-current) - `Goodwill string` Goodwill - `GoodwillAndIntangibleAssets string` Goodwill and intangible assets combined - `IntangibleAssets string` Intangible assets - `Inventory string` Inventory - `LongTermDebt string` Long-term debt - `LongTermInvestments string` Long-term investments - `MinorityInterest string` Minority interest - `NetDebt string` Net debt (total debt minus cash) - `NetReceivables string` Net receivables - `OtherAssets string` Other assets - `OtherCurrentAssets string` Other current assets - `OtherCurrentLiabilities string` Other current liabilities - `OtherLiabilities string` Other liabilities - `OtherNonCurrentAssets string` Other non-current assets - `OtherNonCurrentLiabilities string` Other non-current liabilities - `OtherPayables string` Other payables - `OtherReceivables string` Other receivables - `OtherTotalStockholdersEquity string` Other total stockholders equity - `PreferredStock string` Preferred stock - `Prepaids string` Prepaids - `PropertyPlantAndEquipmentNet string` Property, plant and equipment net of depreciation - `RetainedEarnings string` Retained earnings - `ShortTermDebt string` Short-term debt - `ShortTermInvestments string` Short-term investments - `TaxAssets string` Tax assets - `TaxPayables string` Tax payables - `TotalAssets string` Total assets - `TotalCurrentAssets string` Total current assets - `TotalCurrentLiabilities string` Total current liabilities - `TotalDebt string` Total debt - `TotalEquity string` Total equity - `TotalInvestments string` Total investments - `TotalLiabilities string` Total liabilities - `TotalLiabilitiesAndTotalEquity string` Total liabilities and total equity - `TotalNonCurrentAssets string` Total non-current assets - `TotalNonCurrentLiabilities string` Total non-current liabilities - `TotalPayables string` Total payables - `TotalStockholdersEquity string` Total stockholders equity - `TreasuryStock string` Treasury stock ### Instrument Cash Flow Statement - `type InstrumentCashFlowStatement struct{…}` A quarterly cash flow statement for an instrument. - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountsPayables string` Change in accounts payables - `AccountsReceivables string` Change in accounts receivables - `AcquisitionsNet string` Net acquisitions - `CapitalExpenditure string` Capital expenditure - `CashAtBeginningOfPeriod string` Cash and cash equivalents at beginning of period - `CashAtEndOfPeriod string` Cash and cash equivalents at end of period - `ChangeInWorkingCapital string` Change in working capital - `CommonDividendsPaid string` Common dividends paid - `CommonStockIssuance string` Common stock issuance - `CommonStockRepurchased string` Common stock repurchased (buybacks) - `DeferredIncomeTax string` Deferred income tax expense - `DepreciationAndAmortization string` Depreciation and amortization expense - `EffectOfForexChangesOnCash string` Effect of foreign exchange changes on cash - `FreeCashFlow string` Free cash flow (operating cash flow minus capital expenditure) - `IncomeTaxesPaid string` Income taxes paid - `InterestPaid string` Interest paid - `Inventory string` Change in inventory - `InvestmentsInPropertyPlantAndEquipment string` Investments in property, plant, and equipment - `LongTermNetDebtIssuance string` Long-term net debt issuance - `NetCashProvidedByFinancingActivities string` Net cash provided by financing activities - `NetCashProvidedByInvestingActivities string` Net cash provided by investing activities - `NetCashProvidedByOperatingActivities string` Net cash provided by operating activities - `NetChangeInCash string` Net change in cash during the period - `NetCommonStockIssuance string` Net common stock issuance - `NetDebtIssuance string` Net debt issuance (long-term + short-term) - `NetDividendsPaid string` Net dividends paid (common + preferred) - `NetIncome string` Net income for the period - `NetPreferredStockIssuance string` Net preferred stock issuance - `NetStockIssuance string` Net stock issuance (common + preferred) - `OperatingCashFlow string` Operating cash flow (alternative calculation) - `OtherFinancingActivities string` Other financing activities - `OtherInvestingActivities string` Other investing activities - `OtherNonCashItems string` Other non-cash items - `OtherWorkingCapital string` Change in other working capital - `PreferredDividendsPaid string` Preferred dividends paid - `PurchasesOfInvestments string` Purchases of investments - `SalesMaturitiesOfInvestments string` Sales and maturities of investments - `ShortTermNetDebtIssuance string` Short-term net debt issuance - `StockBasedCompensation string` Stock-based compensation expense ### Instrument Cash Flow Statement List - `type InstrumentCashFlowStatementList []InstrumentCashFlowStatement` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `AccountsPayables string` Change in accounts payables - `AccountsReceivables string` Change in accounts receivables - `AcquisitionsNet string` Net acquisitions - `CapitalExpenditure string` Capital expenditure - `CashAtBeginningOfPeriod string` Cash and cash equivalents at beginning of period - `CashAtEndOfPeriod string` Cash and cash equivalents at end of period - `ChangeInWorkingCapital string` Change in working capital - `CommonDividendsPaid string` Common dividends paid - `CommonStockIssuance string` Common stock issuance - `CommonStockRepurchased string` Common stock repurchased (buybacks) - `DeferredIncomeTax string` Deferred income tax expense - `DepreciationAndAmortization string` Depreciation and amortization expense - `EffectOfForexChangesOnCash string` Effect of foreign exchange changes on cash - `FreeCashFlow string` Free cash flow (operating cash flow minus capital expenditure) - `IncomeTaxesPaid string` Income taxes paid - `InterestPaid string` Interest paid - `Inventory string` Change in inventory - `InvestmentsInPropertyPlantAndEquipment string` Investments in property, plant, and equipment - `LongTermNetDebtIssuance string` Long-term net debt issuance - `NetCashProvidedByFinancingActivities string` Net cash provided by financing activities - `NetCashProvidedByInvestingActivities string` Net cash provided by investing activities - `NetCashProvidedByOperatingActivities string` Net cash provided by operating activities - `NetChangeInCash string` Net change in cash during the period - `NetCommonStockIssuance string` Net common stock issuance - `NetDebtIssuance string` Net debt issuance (long-term + short-term) - `NetDividendsPaid string` Net dividends paid (common + preferred) - `NetIncome string` Net income for the period - `NetPreferredStockIssuance string` Net preferred stock issuance - `NetStockIssuance string` Net stock issuance (common + preferred) - `OperatingCashFlow string` Operating cash flow (alternative calculation) - `OtherFinancingActivities string` Other financing activities - `OtherInvestingActivities string` Other investing activities - `OtherNonCashItems string` Other non-cash items - `OtherWorkingCapital string` Change in other working capital - `PreferredDividendsPaid string` Preferred dividends paid - `PurchasesOfInvestments string` Purchases of investments - `SalesMaturitiesOfInvestments string` Sales and maturities of investments - `ShortTermNetDebtIssuance string` Short-term net debt issuance - `StockBasedCompensation string` Stock-based compensation expense ### Instrument Dividend Event - `type InstrumentDividendEvent struct{…}` Represents a dividend event for an instrument - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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 - `type InstrumentEarnings struct{…}` Represents instrument earnings data - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue ### Instrument Event Envelope - `type InstrumentEventEnvelope struct{…}` Unified envelope for the all-events response. - `Symbol string` Symbol associated with the event. - `Type AllEventsEventType` Event type discriminator. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` - `DividendEventData InstrumentDividendEvent` Dividend payload when type is DIVIDEND. - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `EarningsEventData InstrumentEarnings` Earnings payload when type is EARNINGS. - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument identifier, when the instrument is found in the instrument cache. - `IpoEventData InstrumentEventIpoItem` IPO payload when type is IPO. - `Actions string` IPO action. - `AnnouncedAt Time` IPO announced timestamp. - `Company string` IPO company name. - `Exchange string` IPO exchange. - `MarketCap string` IPO market cap. - `PriceRange string` IPO price range. - `Shares string` IPO shares offered. - `Name string` Instrument name associated with the event, when available. - `ReportingCurrency string` The currency used for reporting financial data. - `StockSplitEventData InstrumentSplitEvent` Stock split payload when type is STOCK_SPLIT. - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Event Ipo Item - `type InstrumentEventIpoItem struct{…}` IPO event in the all-events date grouping response. - `Actions string` IPO action. - `AnnouncedAt Time` IPO announced timestamp. - `Company string` IPO company name. - `Exchange string` IPO exchange. - `MarketCap string` IPO market cap. - `PriceRange string` IPO price range. - `Shares string` IPO shares offered. ### Instrument Events By Date - `type InstrumentEventsByDate struct{…}` Instrument events for a single date. - `Date Time` Event date. - `Events []InstrumentEventEnvelope` Flat event envelopes for this date. - `Symbol string` Symbol associated with the event. - `Type AllEventsEventType` Event type discriminator. - `const AllEventsEventTypeEarnings AllEventsEventType = "EARNINGS"` - `const AllEventsEventTypeDividend AllEventsEventType = "DIVIDEND"` - `const AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"` - `const AllEventsEventTypeIpo AllEventsEventType = "IPO"` - `DividendEventData InstrumentDividendEvent` Dividend payload when type is DIVIDEND. - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `EarningsEventData InstrumentEarnings` Earnings payload when type is EARNINGS. - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument identifier, when the instrument is found in the instrument cache. - `IpoEventData InstrumentEventIpoItem` IPO payload when type is IPO. - `Actions string` IPO action. - `AnnouncedAt Time` IPO announced timestamp. - `Company string` IPO company name. - `Exchange string` IPO exchange. - `MarketCap string` IPO market cap. - `PriceRange string` IPO price range. - `Shares string` IPO shares offered. - `Name string` Instrument name associated with the event, when available. - `ReportingCurrency string` The currency used for reporting financial data. - `StockSplitEventData InstrumentSplitEvent` Stock split payload when type is STOCK_SPLIT. - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Instrument Events Data - `type InstrumentEventsData struct{…}` Grouped instrument events by type - `Dividends []InstrumentDividendEvent` Dividend distribution events - `AdjustedDividendAmount string` The adjusted dividend amount accounting for any splits. - `ExDate Time` The day the stock starts trading without the right to receive that dividend. - `DeclarationDate Time` The declaration date of the dividend - `DividendAmount string` The dividend amount per share. - `DividendYield string` The dividend yield as a percentage of the stock price. - `Frequency string` The frequency of the dividend payments (e.g., "Quarterly", "Annual"). - `PaymentDate Time` The payment date is the date on which a declared stock dividend is scheduled to be paid. - `RecordDate Time` 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. - `Earnings []InstrumentEarnings` Earnings announcement events - `Date Time` The date when the earnings report was published - `EpsActual string` The actual earnings per share (EPS) for the period - `EpsEstimate string` The estimated earnings per share (EPS) for the period - `EpsSurprisePercent string` The percentage difference between actual and estimated EPS - `RevenueActual string` The actual total revenue for the period - `RevenueEstimate string` The estimated total revenue for the period - `RevenueSurprisePercent string` The percentage difference between actual and estimated revenue - `InstrumentID string` OEMS instrument UUID from the request - `Splits []InstrumentSplitEvent` Stock split events - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") - `ReportingCurrency string` The currency used for reporting financial data ### Instrument Fundamentals - `type InstrumentFundamentals struct{…}` Supplemental fundamentals and company profile data for an instrument. - `AverageVolume int64` The average daily trading volume over the past 30 days - `Beta string` The beta value, measuring the instrument's volatility relative to the overall market - `Description string` A detailed description of the instrument or company - `DividendYield string` The trailing twelve months (TTM) dividend yield - `EarningsPerShare string` The trailing twelve months (TTM) earnings per share - `FiftyTwoWeekHigh string` The highest price over the last 52 weeks - `FiftyTwoWeekLow string` The lowest price over the last 52 weeks - `Industry string` The specific industry of the instrument's issuer - `ListDate Time` The date the instrument was first listed - `LogoURL string` URL to a representative logo image for the instrument or issuer - `MarketCap string` The total market capitalization - `PreviousClose string` The closing price from the previous trading day - `PriceToEarnings string` The price-to-earnings (P/E) ratio for the trailing twelve months (TTM) - `ReportingCurrency string` The currency used for reporting financial data - `Sector string` The business sector of the instrument's issuer ### Instrument Income Statement - `type InstrumentIncomeStatement struct{…}` A quarterly income statement for an instrument. - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `BottomLineNetIncome string` Bottom line net income after all adjustments - `CostAndExpenses string` Total costs and expenses - `CostOfRevenue string` Direct costs attributable to producing goods sold - `DepreciationAndAmortization string` Depreciation and amortization expenses - `Ebit string` Earnings before interest and taxes - `Ebitda string` Earnings before interest, taxes, depreciation, and amortization - `Eps string` Basic earnings per share - `EpsDiluted string` Diluted earnings per share - `GeneralAndAdministrativeExpenses string` General administrative overhead expenses - `GrossProfit string` Revenue minus cost of revenue - `IncomeBeforeTax string` Income before income tax expense - `IncomeTaxExpense string` Income tax expense for the period - `InterestExpense string` Interest paid on debt - `InterestIncome string` Interest earned on investments and cash - `NetIncome string` Total net income for the period - `NetIncomeDeductions string` Deductions from net income - `NetIncomeFromContinuingOperations string` Net income from continuing operations - `NetIncomeFromDiscontinuedOperations string` Net income from discontinued operations - `NetInterestIncome string` Net interest income (interest income minus interest expense) - `NonOperatingIncomeExcludingInterest string` Non-operating income excluding interest - `OperatingExpenses string` Total operating expenses - `OperatingIncome string` Income from core business operations - `OtherAdjustmentsToNetIncome string` Other adjustments to net income - `OtherExpenses string` Other miscellaneous expenses - `ResearchAndDevelopmentExpenses string` Expenditure on research and development activities - `Revenue string` Total revenue from sales of goods and services - `SellingAndMarketingExpenses string` Expenditure on marketing and sales activities - `SellingGeneralAndAdministrativeExpenses string` Combined selling, general, and administrative expenses - `TotalOtherIncomeExpensesNet string` Net of other income and expenses - `WeightedAverageShsOut string` Weighted average shares outstanding (basic) - `WeightedAverageShsOutDil string` Weighted average shares outstanding (diluted) ### Instrument Income Statement List - `type InstrumentIncomeStatementList []InstrumentIncomeStatement` - `AcceptedDate Time` The date and time when the filing was accepted by the SEC - `FilingDate Time` The date the financial statement was filed - `Period string` The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4") - `PeriodType FiscalPeriodType` The type of fiscal period - `const FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"` - `const FiscalPeriodTypeAnnual FiscalPeriodType = "ANNUAL"` - `const FiscalPeriodTypeTtm FiscalPeriodType = "TTM"` - `const FiscalPeriodTypeBiannual FiscalPeriodType = "BIANNUAL"` - `ReportedCurrency string` The currency in which the statement is reported (ISO 4217) - `Year int64` The fiscal year of the statement - `BottomLineNetIncome string` Bottom line net income after all adjustments - `CostAndExpenses string` Total costs and expenses - `CostOfRevenue string` Direct costs attributable to producing goods sold - `DepreciationAndAmortization string` Depreciation and amortization expenses - `Ebit string` Earnings before interest and taxes - `Ebitda string` Earnings before interest, taxes, depreciation, and amortization - `Eps string` Basic earnings per share - `EpsDiluted string` Diluted earnings per share - `GeneralAndAdministrativeExpenses string` General administrative overhead expenses - `GrossProfit string` Revenue minus cost of revenue - `IncomeBeforeTax string` Income before income tax expense - `IncomeTaxExpense string` Income tax expense for the period - `InterestExpense string` Interest paid on debt - `InterestIncome string` Interest earned on investments and cash - `NetIncome string` Total net income for the period - `NetIncomeDeductions string` Deductions from net income - `NetIncomeFromContinuingOperations string` Net income from continuing operations - `NetIncomeFromDiscontinuedOperations string` Net income from discontinued operations - `NetInterestIncome string` Net interest income (interest income minus interest expense) - `NonOperatingIncomeExcludingInterest string` Non-operating income excluding interest - `OperatingExpenses string` Total operating expenses - `OperatingIncome string` Income from core business operations - `OtherAdjustmentsToNetIncome string` Other adjustments to net income - `OtherExpenses string` Other miscellaneous expenses - `ResearchAndDevelopmentExpenses string` Expenditure on research and development activities - `Revenue string` Total revenue from sales of goods and services - `SellingAndMarketingExpenses string` Expenditure on marketing and sales activities - `SellingGeneralAndAdministrativeExpenses string` Combined selling, general, and administrative expenses - `TotalOtherIncomeExpensesNet string` Net of other income and expenses - `WeightedAverageShsOut string` Weighted average shares outstanding (basic) - `WeightedAverageShsOutDil string` Weighted average shares outstanding (diluted) ### Instrument Split Event - `type InstrumentSplitEvent struct{…}` Represents a stock split event for an instrument - `Date Time` The date of the stock split - `Denominator string` The denominator of the split ratio - `Numerator string` The numerator of the split ratio - `SplitType string` The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue") ### Price Target - `type PriceTarget struct{…}` Analyst price target statistics - `Average string` Average analyst price target - `Currency string` ISO 4217 currency code of the price targets - `High string` Highest analyst price target - `Low string` Lowest analyst price target # Market Data ## Get Snapshots `client.V1.InstrumentData.MarketData.GetSnapshots(ctx, query) (*V1InstrumentDataMarketDataGetSnapshotsResponse, error)` **get** `/v1/market-data/snapshot` Get market data snapshots for one or more securities. ### Parameters - `query V1InstrumentDataMarketDataGetSnapshotsParams` - `InstrumentIDs param.Field[[]string]` Comma-separated OEMS instrument UUIDs. ### Returns - `type V1InstrumentDataMarketDataGetSnapshotsResponse struct{…}` - `Data MarketDataSnapshotList` - `InstrumentID string` OEMS instrument identifier. - `Symbol string` Display symbol for the security. - `CumulativeVolume int64` Cumulative traded volume reported on the most recent trade, in shares for equities or contracts for options. Absent when no trade is available. - `LastQuote SnapshotQuote` Most recent quote if available. - `Ask string` Current best ask. - `Bid string` Current best bid. - `Midpoint string` Midpoint of bid and ask. - `AskSize int64` Size at the best ask, in shares. - `BidSize int64` Size at the best bid, in shares. - `LastTrade SnapshotLastTrade` Most recent last-sale trade if available. - `Price string` Most recent last-sale eligible trade price. - `Name string` Security name if available. - `Session SnapshotSession` Session metrics computed from previous close and last trade, if available. - `Change string` Absolute change from previous close to last trade. - `ChangePercent string` Percent change from previous close to last trade. - `PreviousClose string` Previous session close price. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.MarketData.GetSnapshots(context.TODO(), clearstreet.V1InstrumentDataMarketDataGetSnapshotsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.InstrumentData.MarketData.GetDailySummaries(ctx, query) (*V1InstrumentDataMarketDataGetDailySummariesResponse, error)` **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 - `query V1InstrumentDataMarketDataGetDailySummariesParams` - `InstrumentIDs param.Field[string]` Comma-separated OEMS instrument UUIDs (required, 1..=100) ### Returns - `type V1InstrumentDataMarketDataGetDailySummariesResponse struct{…}` - `Data DailySummaryList` - `InstrumentID string` OEMS instrument identifier. Always populated; echoes the request ID. - `High string` Session high. - `Low string` Session low. - `Open string` Opening price for the session. - `Symbol string` Display symbol for the security. `None` for unresolvable IDs. - `TradeDate Time` Session date the OHLV represents, US/Eastern. - `Volume int64` Session cumulative trading volume. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.MarketData.GetDailySummaries(context.TODO(), clearstreet.V1InstrumentDataMarketDataGetDailySummariesParams{ InstrumentIDs: "instrument_ids", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type DailySummary struct{…}` 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). - `InstrumentID string` OEMS instrument identifier. Always populated; echoes the request ID. - `High string` Session high. - `Low string` Session low. - `Open string` Opening price for the session. - `Symbol string` Display symbol for the security. `None` for unresolvable IDs. - `TradeDate Time` Session date the OHLV represents, US/Eastern. - `Volume int64` Session cumulative trading volume. ### Daily Summary List - `type DailySummaryList []DailySummary` - `InstrumentID string` OEMS instrument identifier. Always populated; echoes the request ID. - `High string` Session high. - `Low string` Session low. - `Open string` Opening price for the session. - `Symbol string` Display symbol for the security. `None` for unresolvable IDs. - `TradeDate Time` Session date the OHLV represents, US/Eastern. - `Volume int64` Session cumulative trading volume. ### Market Data Snapshot - `type MarketDataSnapshot struct{…}` Market data snapshot for a single security. - `InstrumentID string` OEMS instrument identifier. - `Symbol string` Display symbol for the security. - `CumulativeVolume int64` Cumulative traded volume reported on the most recent trade, in shares for equities or contracts for options. Absent when no trade is available. - `LastQuote SnapshotQuote` Most recent quote if available. - `Ask string` Current best ask. - `Bid string` Current best bid. - `Midpoint string` Midpoint of bid and ask. - `AskSize int64` Size at the best ask, in shares. - `BidSize int64` Size at the best bid, in shares. - `LastTrade SnapshotLastTrade` Most recent last-sale trade if available. - `Price string` Most recent last-sale eligible trade price. - `Name string` Security name if available. - `Session SnapshotSession` Session metrics computed from previous close and last trade, if available. - `Change string` Absolute change from previous close to last trade. - `ChangePercent string` Percent change from previous close to last trade. - `PreviousClose string` Previous session close price. ### Market Data Snapshot List - `type MarketDataSnapshotList []MarketDataSnapshot` - `InstrumentID string` OEMS instrument identifier. - `Symbol string` Display symbol for the security. - `CumulativeVolume int64` Cumulative traded volume reported on the most recent trade, in shares for equities or contracts for options. Absent when no trade is available. - `LastQuote SnapshotQuote` Most recent quote if available. - `Ask string` Current best ask. - `Bid string` Current best bid. - `Midpoint string` Midpoint of bid and ask. - `AskSize int64` Size at the best ask, in shares. - `BidSize int64` Size at the best bid, in shares. - `LastTrade SnapshotLastTrade` Most recent last-sale trade if available. - `Price string` Most recent last-sale eligible trade price. - `Name string` Security name if available. - `Session SnapshotSession` Session metrics computed from previous close and last trade, if available. - `Change string` Absolute change from previous close to last trade. - `ChangePercent string` Percent change from previous close to last trade. - `PreviousClose string` Previous session close price. ### Snapshot Last Trade - `type SnapshotLastTrade struct{…}` Last-trade fields for a market data snapshot. - `Price string` Most recent last-sale eligible trade price. ### Snapshot Quote - `type SnapshotQuote struct{…}` L1 quote fields for a market data snapshot. - `Ask string` Current best ask. - `Bid string` Current best bid. - `Midpoint string` Midpoint of bid and ask. - `AskSize int64` Size at the best ask, in shares. - `BidSize int64` Size at the best bid, in shares. ### Snapshot Session - `type SnapshotSession struct{…}` Session-level pricing metrics for a market data snapshot. - `Change string` Absolute change from previous close to last trade. - `ChangePercent string` Percent change from previous close to last trade. - `PreviousClose string` Previous session close price. # News ## Get News `client.V1.InstrumentData.News.GetNews(ctx, query) (*V1InstrumentDataNewsGetNewsResponse, error)` **get** `/v1/news` Retrieves news items with optional filtering by security IDs, time range, publisher, type, and text query. ### Parameters - `query V1InstrumentDataNewsGetNewsParams` - `ExcludePublishers param.Field[string]` Comma-separated list of publishers to exclude (mutually exclusive with include_publishers). - `From param.Field[string]` Inclusive start timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime. - `IncludePublishers param.Field[string]` Comma-separated list of publishers to include (mutually exclusive with exclude_publishers). - `InstrumentIDs param.Field[[]string]` Comma-delimited OEMS instrument UUIDs to filter by. - `NewsType param.Field[V1InstrumentDataNewsGetNewsParamsNewsType]` Filter by news type. - `const V1InstrumentDataNewsGetNewsParamsNewsTypeNews V1InstrumentDataNewsGetNewsParamsNewsType = "NEWS"` - `const V1InstrumentDataNewsGetNewsParamsNewsTypePressRelease V1InstrumentDataNewsGetNewsParamsNewsType = "PRESS_RELEASE"` - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `SearchQuery param.Field[string]` Free-text query matched against title/text and associated security IDs. - `Sectors param.Field[[]string]` Comma-separated sector values to filter by. - `const V1InstrumentDataNewsGetNewsParamsSectorBasicMaterials V1InstrumentDataNewsGetNewsParamsSector = "BASIC_MATERIALS"` - `const V1InstrumentDataNewsGetNewsParamsSectorCommunicationServices V1InstrumentDataNewsGetNewsParamsSector = "COMMUNICATION_SERVICES"` - `const V1InstrumentDataNewsGetNewsParamsSectorConsumerCyclical V1InstrumentDataNewsGetNewsParamsSector = "CONSUMER_CYCLICAL"` - `const V1InstrumentDataNewsGetNewsParamsSectorConsumerDefensive V1InstrumentDataNewsGetNewsParamsSector = "CONSUMER_DEFENSIVE"` - `const V1InstrumentDataNewsGetNewsParamsSectorEnergy V1InstrumentDataNewsGetNewsParamsSector = "ENERGY"` - `const V1InstrumentDataNewsGetNewsParamsSectorFinancialServices V1InstrumentDataNewsGetNewsParamsSector = "FINANCIAL_SERVICES"` - `const V1InstrumentDataNewsGetNewsParamsSectorHealthcare V1InstrumentDataNewsGetNewsParamsSector = "HEALTHCARE"` - `const V1InstrumentDataNewsGetNewsParamsSectorIndustrials V1InstrumentDataNewsGetNewsParamsSector = "INDUSTRIALS"` - `const V1InstrumentDataNewsGetNewsParamsSectorRealEstate V1InstrumentDataNewsGetNewsParamsSector = "REAL_ESTATE"` - `const V1InstrumentDataNewsGetNewsParamsSectorTechnology V1InstrumentDataNewsGetNewsParamsSector = "TECHNOLOGY"` - `const V1InstrumentDataNewsGetNewsParamsSectorUtilities V1InstrumentDataNewsGetNewsParamsSector = "UTILITIES"` - `To param.Field[string]` Inclusive end timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime. ### Returns - `type V1InstrumentDataNewsGetNewsResponse struct{…}` - `Data NewsItemList` - `Instruments []NewsInstrument` Instruments associated with this news item. - `InstrumentID string` OEMS instrument UUID. - `Name string` Instrument name/description, if available from instrument cache enrichment. - `Symbol string` Trading symbol, if available from instrument cache enrichment. - `NewsType NewsType` Classification of the item. - `const NewsTypeNews NewsType = "NEWS"` - `const NewsTypePressRelease NewsType = "PRESS_RELEASE"` - `PublishedAt Time` The published date/time of the article in UTC. - `Publisher string` The publisher or newswire source. - `Title string` The headline/title of the article. - `URL string` Canonical URL to the full article. - `ImageURL string` URL of an associated image if provided by the source. - `Site string` The primary domain/site of the publisher. - `Text string` The full or excerpted article body. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.InstrumentData.News.GetNews(context.TODO(), clearstreet.V1InstrumentDataNewsGetNewsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type NewsInstrument struct{…}` Instrument associated with a news item. - `InstrumentID string` OEMS instrument UUID. - `Name string` Instrument name/description, if available from instrument cache enrichment. - `Symbol string` Trading symbol, if available from instrument cache enrichment. ### News Item - `type NewsItem struct{…}` A single news item and its associated instruments. - `Instruments []NewsInstrument` Instruments associated with this news item. - `InstrumentID string` OEMS instrument UUID. - `Name string` Instrument name/description, if available from instrument cache enrichment. - `Symbol string` Trading symbol, if available from instrument cache enrichment. - `NewsType NewsType` Classification of the item. - `const NewsTypeNews NewsType = "NEWS"` - `const NewsTypePressRelease NewsType = "PRESS_RELEASE"` - `PublishedAt Time` The published date/time of the article in UTC. - `Publisher string` The publisher or newswire source. - `Title string` The headline/title of the article. - `URL string` Canonical URL to the full article. - `ImageURL string` URL of an associated image if provided by the source. - `Site string` The primary domain/site of the publisher. - `Text string` The full or excerpted article body. ### News Item List - `type NewsItemList []NewsItem` - `Instruments []NewsInstrument` Instruments associated with this news item. - `InstrumentID string` OEMS instrument UUID. - `Name string` Instrument name/description, if available from instrument cache enrichment. - `Symbol string` Trading symbol, if available from instrument cache enrichment. - `NewsType NewsType` Classification of the item. - `const NewsTypeNews NewsType = "NEWS"` - `const NewsTypePressRelease NewsType = "PRESS_RELEASE"` - `PublishedAt Time` The published date/time of the article in UTC. - `Publisher string` The publisher or newswire source. - `Title string` The headline/title of the article. - `URL string` Canonical URL to the full article. - `ImageURL string` URL of an associated image if provided by the source. - `Site string` The primary domain/site of the publisher. - `Text string` The full or excerpted article body. ### News Type - `type NewsType string` News item classification. - `const NewsTypeNews NewsType = "NEWS"` - `const NewsTypePressRelease NewsType = "PRESS_RELEASE"` # Instruments ## Get Instruments `client.V1.Instruments.GetInstruments(ctx, query) (*V1InstrumentGetInstrumentsResponse, error)` **get** `/v1/instruments` Retrieves a list of tradeable instruments. ### Parameters - `query V1InstrumentGetInstrumentsParams` - `EasyToBorrow param.Field[bool]` Filter by easy to borrow status - `InstrumentIDs param.Field[[]string]` Comma-separated OEMS instrument UUIDs - `InstrumentType param.Field[V1InstrumentGetInstrumentsParamsInstrumentType]` 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. - `const V1InstrumentGetInstrumentsParamsInstrumentTypeCommonStock V1InstrumentGetInstrumentsParamsInstrumentType = "COMMON_STOCK"` - `const V1InstrumentGetInstrumentsParamsInstrumentTypePreferredStock V1InstrumentGetInstrumentsParamsInstrumentType = "PREFERRED_STOCK"` - `const V1InstrumentGetInstrumentsParamsInstrumentTypeOption V1InstrumentGetInstrumentsParamsInstrumentType = "OPTION"` - `const V1InstrumentGetInstrumentsParamsInstrumentTypeCash V1InstrumentGetInstrumentsParamsInstrumentType = "CASH"` - `const V1InstrumentGetInstrumentsParamsInstrumentTypeOther V1InstrumentGetInstrumentsParamsInstrumentType = "OTHER"` - `IsLiquidationOnly param.Field[bool]` Filter by liquidation only status - `IsMarginable param.Field[bool]` Filter by marginable status - `IsRestricted param.Field[bool]` Filter by restricted status - `IsShortProhibited param.Field[bool]` Filter by short prohibited status - `IsThresholdSecurity param.Field[bool]` Filter by threshold security status - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1InstrumentGetInstrumentsResponse struct{…}` - `Data InstrumentCoreList` - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Instruments.GetInstruments(context.TODO(), clearstreet.V1InstrumentGetInstrumentsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Instruments.GetInstrumentByID(ctx, instrumentID, query) (*V1InstrumentGetInstrumentByIDResponse, error)` **get** `/v1/instruments/{instrument_id}` Retrieves detailed information for a specific instrument. ### Parameters - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `query V1InstrumentGetInstrumentByIDParams` - `IncludeOptionsExpiryDates param.Field[bool]` When true, include unique options expiry dates for this instrument ### Returns - `type V1InstrumentGetInstrumentByIDResponse struct{…}` - `Data Instrument` Represents a tradable financial instrument. - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `OptionsExpiryDates []Time` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Instruments.GetInstrumentByID( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1InstrumentGetInstrumentByIDParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Instruments.SearchInstruments(ctx, query) (*V1InstrumentSearchInstrumentsResponse, error)` **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 - `query V1InstrumentSearchInstrumentsParams` - `Q param.Field[string]` 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. - `AssetClass param.Field[string]` Comma-separated asset classes (EQUITY|OPTION|WARRANT|BOND|FX|OTHER). Defaults to EQUITY. - `Country param.Field[string]` Optional listing-country filter (e.g., US). - `Currency param.Field[string]` Optional ISO currency filter (e.g., USD). - `IncludeInactive param.Field[bool]` Include inactive instruments. Default false. - `IncludeRestricted param.Field[bool]` Include restricted instruments. Default true (penalized in ranking). - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1InstrumentSearchInstrumentsResponse struct{…}` - `Data InstrumentCoreList` - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Instruments.SearchInstruments(context.TODO(), clearstreet.V1InstrumentSearchInstrumentsParams{ Q: "q", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Instruments.GetOptionContracts(ctx, query) (*V1InstrumentGetOptionContractsResponse, error)` **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 - `query V1InstrumentGetOptionContractsParams` - `ContractType param.Field[ContractType]` Filter by contract type: CALL or PUT - `Expiry param.Field[Time]` Filter to contracts expiring on this date (YYYY-MM-DD) - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Underlier param.Field[string]` Underlier symbol (e.g., AAPL, SPX) - `UnderlyingInstrumentID param.Field[InstrumentIDOrSymbol]` OEMS instrument UUID or symbol of the underlying equity/index ### Returns - `type V1InstrumentGetOptionContractsResponse struct{…}` - `Data OptionsContractList` - `ID string` OEMS instrument identifier - `ContractType ContractType` Whether this is a CALL or PUT - `const ContractTypeCall ContractType = "CALL"` - `const ContractTypePut ContractType = "PUT"` - `Currency string` ISO currency code - `Exchange string` MIC code of the primary listing venue - `ExerciseStyle ExerciseStyle` Exercise style - `const ExerciseStyleAmerican ExerciseStyle = "AMERICAN"` - `const ExerciseStyleEuropean ExerciseStyle = "EUROPEAN"` - `Expiry Time` Expiration date - `IsLiquidationOnly bool` Whether the contract is liquidation-only - `IsMarginable bool` Whether the contract is marginable - `IsRestricted bool` Whether the contract is restricted from trading - `ListingType ListingType` Listing type - `const ListingTypeStandard ListingType = "STANDARD"` - `const ListingTypeFlex ListingType = "FLEX"` - `const ListingTypeOtc ListingType = "OTC"` - `Multiplier string` Contract multiplier (100 for standard options) - `StrikePrice string` Strike price - `Symbol string` OSI symbol (e.g. "AAPL 251219C00150000") - `OpenInterest int64` Open interest (number of outstanding contracts), if available - `UnderlyingInstrumentID string` OEMS instrument ID of the underlying instrument, if resolvable ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Instruments.GetOptionContracts(context.TODO(), clearstreet.V1InstrumentGetOptionContractsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type ContractType string` The type of options contract - `const ContractTypeCall ContractType = "CALL"` - `const ContractTypePut ContractType = "PUT"` ### Exercise Style - `type ExerciseStyle string` The exercise style of an options contract - `const ExerciseStyleAmerican ExerciseStyle = "AMERICAN"` - `const ExerciseStyleEuropean ExerciseStyle = "EUROPEAN"` ### Instrument - `type Instrument struct{…}` Represents a tradable financial instrument. - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `OptionsExpiryDates []Time` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Instrument Core - `type InstrumentCore struct{…}` - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Instrument Core List - `type InstrumentCoreList []InstrumentCore` - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments ### Listing Type - `type ListingType string` The listing type of an options contract - `const ListingTypeStandard ListingType = "STANDARD"` - `const ListingTypeFlex ListingType = "FLEX"` - `const ListingTypeOtc ListingType = "OTC"` ### Options Contract - `type OptionsContract struct{…}` An options contract with options-specific metadata - `ID string` OEMS instrument identifier - `ContractType ContractType` Whether this is a CALL or PUT - `const ContractTypeCall ContractType = "CALL"` - `const ContractTypePut ContractType = "PUT"` - `Currency string` ISO currency code - `Exchange string` MIC code of the primary listing venue - `ExerciseStyle ExerciseStyle` Exercise style - `const ExerciseStyleAmerican ExerciseStyle = "AMERICAN"` - `const ExerciseStyleEuropean ExerciseStyle = "EUROPEAN"` - `Expiry Time` Expiration date - `IsLiquidationOnly bool` Whether the contract is liquidation-only - `IsMarginable bool` Whether the contract is marginable - `IsRestricted bool` Whether the contract is restricted from trading - `ListingType ListingType` Listing type - `const ListingTypeStandard ListingType = "STANDARD"` - `const ListingTypeFlex ListingType = "FLEX"` - `const ListingTypeOtc ListingType = "OTC"` - `Multiplier string` Contract multiplier (100 for standard options) - `StrikePrice string` Strike price - `Symbol string` OSI symbol (e.g. "AAPL 251219C00150000") - `OpenInterest int64` Open interest (number of outstanding contracts), if available - `UnderlyingInstrumentID string` OEMS instrument ID of the underlying instrument, if resolvable ### Options Contract List - `type OptionsContractList []OptionsContract` - `ID string` OEMS instrument identifier - `ContractType ContractType` Whether this is a CALL or PUT - `const ContractTypeCall ContractType = "CALL"` - `const ContractTypePut ContractType = "PUT"` - `Currency string` ISO currency code - `Exchange string` MIC code of the primary listing venue - `ExerciseStyle ExerciseStyle` Exercise style - `const ExerciseStyleAmerican ExerciseStyle = "AMERICAN"` - `const ExerciseStyleEuropean ExerciseStyle = "EUROPEAN"` - `Expiry Time` Expiration date - `IsLiquidationOnly bool` Whether the contract is liquidation-only - `IsMarginable bool` Whether the contract is marginable - `IsRestricted bool` Whether the contract is restricted from trading - `ListingType ListingType` Listing type - `const ListingTypeStandard ListingType = "STANDARD"` - `const ListingTypeFlex ListingType = "FLEX"` - `const ListingTypeOtc ListingType = "OTC"` - `Multiplier string` Contract multiplier (100 for standard options) - `StrikePrice string` Strike price - `Symbol string` OSI symbol (e.g. "AAPL 251219C00150000") - `OpenInterest int64` Open interest (number of outstanding contracts), if available - `UnderlyingInstrumentID string` OEMS instrument ID of the underlying instrument, if resolvable # Omni AI ## Domain Types ### Action Button - `type ActionButton struct{…}` Button metadata shared by chart and suggested-actions payloads. - `ButtonID string` Stable button identifier within the content part. - `Label string` User-visible label. - `Prompt PromptButtonAction` Follow-up prompt to submit as the next user message. - `Prompt string` Prompt text to submit as the next user turn. - `StructuredAction StructuredActionButtonAction` Structured action in the same message to execute on click. - `ActionID string` UUID of a `structured_action` content part in the same message. ### Chart Payload - `type ChartPayload struct{…}` Typed chart payload rendered inline in assistant content. - `ChartID string` Stable chart identifier scoped to the content part. - `ActionButtons []ActionButton` Buttons associated with this chart. - `ButtonID string` Stable button identifier within the content part. - `Label string` User-visible label. - `Prompt PromptButtonAction` Follow-up prompt to submit as the next user message. - `Prompt string` Prompt text to submit as the next user turn. - `StructuredAction StructuredActionButtonAction` Structured action in the same message to execute on click. - `ActionID string` UUID of a `structured_action` content part in the same message. - `DataChart DataChart` Explicit series-driven chart definition. - `Series []ChartSeries` - `Name string` - `Points []ChartPoint` - `X string` - `Y float64` - `SymbolChart SymbolChart` Symbol-driven chart definition. - `Symbol string` - `Timeframe string` ### Chart Point - `type ChartPoint struct{…}` Single chart coordinate. - `X string` - `Y float64` ### Chart Series - `type ChartSeries struct{…}` Named data series within a chart. - `Name string` - `Points []ChartPoint` - `X string` - `Y float64` ### Content Part Chart Payload - `type ContentPartChartPayload struct{…}` Chart payload content part. - `Payload ChartPayload` Typed chart payload rendered inline in assistant content. - `ChartID string` Stable chart identifier scoped to the content part. - `ActionButtons []ActionButton` Buttons associated with this chart. - `ButtonID string` Stable button identifier within the content part. - `Label string` User-visible label. - `Prompt PromptButtonAction` Follow-up prompt to submit as the next user message. - `Prompt string` Prompt text to submit as the next user turn. - `StructuredAction StructuredActionButtonAction` Structured action in the same message to execute on click. - `ActionID string` UUID of a `structured_action` content part in the same message. - `DataChart DataChart` Explicit series-driven chart definition. - `Series []ChartSeries` - `Name string` - `Points []ChartPoint` - `X string` - `Y float64` - `SymbolChart SymbolChart` Symbol-driven chart definition. - `Symbol string` - `Timeframe string` ### Content Part Custom Payload - `type ContentPartCustomPayload struct{…}` Escape-hatch custom payload content part. - `Payload any` ### Content Part Structured Action Payload - `type ContentPartStructuredActionPayload struct{…}` Structured action content part. - `Action StructuredActionUnion` 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. - `type StructuredActionPrefillOrder struct{…}` Prefill an order ticket for user confirmation - `PrefillOrder PrefillOrderActionUnion` Prefill an order ticket for user confirmation - `type PrefillOrderActionPrefillNewOrderAction struct{…}` Create one or more new orders. - `ActionType string` - `const PrefillOrderActionPrefillNewOrderActionActionTypeNew PrefillOrderActionPrefillNewOrderActionActionType = "NEW"` - `type PrefillOrderActionPrefillCancelOrderAction struct{…}` Cancel one or more existing orders. - `ActionType string` - `const PrefillOrderActionPrefillCancelOrderActionActionTypeCancel PrefillOrderActionPrefillCancelOrderActionActionType = "CANCEL"` - `type StructuredActionOpenChart struct{…}` Open a chart for a symbol - `OpenChart OpenChartAction` Open a chart for a symbol - `Symbol string` Trading symbol to chart - `Extras any` Additional chart configuration (indicators, overlays, etc.) - `Timeframe string` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") - `type StructuredActionOpenScreener struct{…}` Open a stock screener with filters - `OpenScreener OpenScreenerAction` Open a stock screener with filters - `Filters []ScreenerFilter` Filter criteria for the screener - `Field string` Field to filter on (e.g., "market_cap", "sector", "price") - `Operator string` Comparison operator (e.g., "eq", "gte", "lte", "in") - `Value any` Filter value - `FieldFilter []string` Optional field/column selection for screener results. - `PageSize int64` Optional page size. - `SortBy string` Optional sort field for screener rows. - `SortDirection string` Optional sort direction (`ASC` or `DESC`). - `type StructuredActionOpenEntitlementConsent struct{…}` Open entitlement consent flow - `OpenEntitlementConsent OpenEntitlementConsentAction` Open entitlement consent flow - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `Reason string` - `RequestedEntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `TradingAccountIDs []int64` - `ActionID string` ### Content Part Suggested Actions Payload - `type ContentPartSuggestedActionsPayload struct{…}` Suggested actions payload content part. - `Payload SuggestedActionsPayload` Suggested follow-up buttons rendered at the end of an assistant message. - `ActionButtons []ActionButton` Ordered message-level buttons. - `ButtonID string` Stable button identifier within the content part. - `Label string` User-visible label. - `Prompt PromptButtonAction` Follow-up prompt to submit as the next user message. - `Prompt string` Prompt text to submit as the next user turn. - `StructuredAction StructuredActionButtonAction` Structured action in the same message to execute on click. - `ActionID string` UUID of a `structured_action` content part in the same message. ### Content Part Text Payload - `type ContentPartTextPayload struct{…}` Text content part. - `Text string` ### Content Part Thinking Payload - `type ContentPartThinkingPayload struct{…}` Thinking content part shown on dynamic response polling. - `Thoughts []string` ### Data Chart - `type DataChart struct{…}` Chart represented by explicit data series. - `Series []ChartSeries` - `Name string` - `Points []ChartPoint` - `X string` - `Y float64` ### Open Chart Action - `type OpenChartAction struct{…}` Action to open a chart for a symbol. - `Symbol string` Trading symbol to chart - `Extras any` Additional chart configuration (indicators, overlays, etc.) - `Timeframe string` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") ### Open Entitlement Consent Action - `type OpenEntitlementConsentAction struct{…}` Action to open entitlement consent flow for one or more accounts. - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `Reason string` - `RequestedEntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `TradingAccountIDs []int64` ### Open Screener Action - `type OpenScreenerAction struct{…}` Action to open a stock screener with filters. - `Filters []ScreenerFilter` Filter criteria for the screener - `Field string` Field to filter on (e.g., "market_cap", "sector", "price") - `Operator string` Comparison operator (e.g., "eq", "gte", "lte", "in") - `Value any` Filter value - `FieldFilter []string` Optional field/column selection for screener results. - `PageSize int64` Optional page size. - `SortBy string` Optional sort field for screener rows. - `SortDirection string` Optional sort direction (`ASC` or `DESC`). ### Prefill Cancel Order Action - `type PrefillCancelOrderAction struct{…}` Cancel-order prefill action. - `Orders []CancelOrderRequest` Orders to cancel using the same identifiers required by the cancel-order API. - `AccountID int64` Account ID (from path parameter) - `OrderID string` Order ID to cancel (from path parameter) ### Prefill New Order Action - `type PrefillNewOrderAction struct{…}` New-order prefill action. - `Orders []NewOrderRequest` Orders to prefill using the same shape accepted by the orders API. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `OrderType RequestOrderType` Type of order - `const RequestOrderTypeMarket RequestOrderType = "MARKET"` - `const RequestOrderTypeLimit RequestOrderType = "LIMIT"` - `const RequestOrderTypeStop RequestOrderType = "STOP"` - `const RequestOrderTypeStopLimit RequestOrderType = "STOP_LIMIT"` - `const RequestOrderTypeTrailingStop RequestOrderType = "TRAILING_STOP"` - `const RequestOrderTypeTrailingStopLimit RequestOrderType = "TRAILING_STOP_LIMIT"` - `Quantity string` 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 - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `TimeInForce RequestTimeInForce` Time in force - `const RequestTimeInForceDay RequestTimeInForce = "DAY"` - `const RequestTimeInForceGoodTillCancel RequestTimeInForce = "GOOD_TILL_CANCEL"` - `const RequestTimeInForceImmediateOrCancel RequestTimeInForce = "IMMEDIATE_OR_CANCEL"` - `const RequestTimeInForceFillOrKill RequestTimeInForce = "FILL_OR_KILL"` - `const RequestTimeInForceGoodTillDate RequestTimeInForce = "GOOD_TILL_DATE"` - `const RequestTimeInForceAtTheOpening RequestTimeInForce = "AT_THE_OPENING"` - `const RequestTimeInForceAtTheClose RequestTimeInForce = "AT_THE_CLOSE"` - `const RequestTimeInForceGoodTillCrossing RequestTimeInForce = "GOOD_TILL_CROSSING"` - `const RequestTimeInForceGoodThroughCrossing RequestTimeInForce = "GOOD_THROUGH_CROSSING"` - `const RequestTimeInForceAtCrossing RequestTimeInForce = "AT_CROSSING"` - `ID string` Optional client-provided unique ID (idempotency). Required to be unique per account. - `ExpiresAt Time` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (required for LIMIT and STOP_LIMIT orders) - `PositionEffect PositionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `const PositionEffectOpen PositionEffect = "OPEN"` - `const PositionEffectClose PositionEffect = "CLOSE"` - `StopPrice string` Stop price (required for STOP and STOP_LIMIT orders) - `Symbol string` 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. - `TrailingOffset string` Trailing offset amount (required for trailing orders) - `TrailingOffsetType TrailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` ### Prefill Order Action - `type PrefillOrderActionUnion interface{…}` 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. - `type PrefillOrderActionPrefillNewOrderAction struct{…}` Create one or more new orders. - `ActionType string` - `const PrefillOrderActionPrefillNewOrderActionActionTypeNew PrefillOrderActionPrefillNewOrderActionActionType = "NEW"` - `type PrefillOrderActionPrefillCancelOrderAction struct{…}` Cancel one or more existing orders. - `ActionType string` - `const PrefillOrderActionPrefillCancelOrderActionActionTypeCancel PrefillOrderActionPrefillCancelOrderActionActionType = "CANCEL"` ### Prompt Button Action - `type PromptButtonAction struct{…}` Prompt-style button behavior. - `Prompt string` Prompt text to submit as the next user turn. ### Screener Filter - `type ScreenerFilter struct{…}` A single filter criterion for the screener. - `Field string` Field to filter on (e.g., "market_cap", "sector", "price") - `Operator string` Comparison operator (e.g., "eq", "gte", "lte", "in") - `Value any` Filter value ### Structured Action - `type StructuredActionUnion interface{…}` 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. - `type StructuredActionPrefillOrder struct{…}` Prefill an order ticket for user confirmation - `PrefillOrder PrefillOrderActionUnion` Prefill an order ticket for user confirmation - `type PrefillOrderActionPrefillNewOrderAction struct{…}` Create one or more new orders. - `ActionType string` - `const PrefillOrderActionPrefillNewOrderActionActionTypeNew PrefillOrderActionPrefillNewOrderActionActionType = "NEW"` - `type PrefillOrderActionPrefillCancelOrderAction struct{…}` Cancel one or more existing orders. - `ActionType string` - `const PrefillOrderActionPrefillCancelOrderActionActionTypeCancel PrefillOrderActionPrefillCancelOrderActionActionType = "CANCEL"` - `type StructuredActionOpenChart struct{…}` Open a chart for a symbol - `OpenChart OpenChartAction` Open a chart for a symbol - `Symbol string` Trading symbol to chart - `Extras any` Additional chart configuration (indicators, overlays, etc.) - `Timeframe string` Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y") - `type StructuredActionOpenScreener struct{…}` Open a stock screener with filters - `OpenScreener OpenScreenerAction` Open a stock screener with filters - `Filters []ScreenerFilter` Filter criteria for the screener - `Field string` Field to filter on (e.g., "market_cap", "sector", "price") - `Operator string` Comparison operator (e.g., "eq", "gte", "lte", "in") - `Value any` Filter value - `FieldFilter []string` Optional field/column selection for screener results. - `PageSize int64` Optional page size. - `SortBy string` Optional sort field for screener rows. - `SortDirection string` Optional sort direction (`ASC` or `DESC`). - `type StructuredActionOpenEntitlementConsent struct{…}` Open entitlement consent flow - `OpenEntitlementConsent OpenEntitlementConsentAction` Open entitlement consent flow - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `Reason string` - `RequestedEntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `TradingAccountIDs []int64` ### Structured Action Button Action - `type StructuredActionButtonAction struct{…}` Structured-action button behavior. - `ActionID string` UUID of a `structured_action` content part in the same message. ### Suggested Actions Payload - `type SuggestedActionsPayload struct{…}` Suggested follow-up buttons rendered at the end of an assistant message. - `ActionButtons []ActionButton` Ordered message-level buttons. - `ButtonID string` Stable button identifier within the content part. - `Label string` User-visible label. - `Prompt PromptButtonAction` Follow-up prompt to submit as the next user message. - `Prompt string` Prompt text to submit as the next user turn. - `StructuredAction StructuredActionButtonAction` Structured action in the same message to execute on click. - `ActionID string` UUID of a `structured_action` content part in the same message. ### Symbol Chart - `type SymbolChart struct{…}` Chart for a single symbol and timeframe. - `Symbol string` - `Timeframe string` # Entitlements ## Get Entitlements `client.V1.OmniAI.Entitlements.GetEntitlements(ctx, query) (*V1OmniAIEntitlementGetEntitlementsResponse, error)` **get** `/v1/omni-ai/entitlements` List caller's active entitlement grants. ### Parameters - `query V1OmniAIEntitlementGetEntitlementsParams` - `TradingAccountID param.Field[int64]` ### Returns - `type V1OmniAIEntitlementGetEntitlementsResponse struct{…}` - `Data EntitlementResourceList` - `AgreementID string` - `EntitlementCode EntitlementCode` Stable entitlement code granted by an agreement. - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `EntitlementID string` - `GrantedAt string` - `TradingAccountID int64` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Entitlements.GetEntitlements(context.TODO(), clearstreet.V1OmniAIEntitlementGetEntitlementsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Entitlements.NewEntitlements(ctx, body) (*V1OmniAIEntitlementNewEntitlementsResponse, error)` **post** `/v1/omni-ai/entitlements` Record consent and upsert one-or-more active grants. ### Parameters - `body V1OmniAIEntitlementNewEntitlementsParams` - `AgreementID param.Field[string]` - `RequestedEntitlementCodes param.Field[[]EntitlementCode]` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `TradingAccountIDs param.Field[[]int64]` ### Returns - `type V1OmniAIEntitlementNewEntitlementsResponse struct{…}` - `Data EntitlementResourceList` - `AgreementID string` - `EntitlementCode EntitlementCode` Stable entitlement code granted by an agreement. - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `EntitlementID string` - `GrantedAt string` - `TradingAccountID int64` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Entitlements.NewEntitlements(context.TODO(), clearstreet.V1OmniAIEntitlementNewEntitlementsParams{ AgreementID: "01JZ0000000000000000000000", RequestedEntitlementCodes: []clearstreet.EntitlementCode{clearstreet.EntitlementCodeOmniAccountData}, TradingAccountIDs: []int64{100019, 100021}, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Entitlements.DeleteEntitlement(ctx, entitlementID) (*V1OmniAIEntitlementDeleteEntitlementResponse, error)` **delete** `/v1/omni-ai/entitlements/{entitlement_id}` Revoke one entitlement grant by id. ### Parameters - `entitlementID string` ### Returns - `type V1OmniAIEntitlementDeleteEntitlementResponse struct{…}` - `Data DeleteEntitlementResponse` - `EntitlementID string` - `Revoked bool` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Entitlements.DeleteEntitlement(context.TODO(), "entitlement_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Entitlements.GetEntitlementAgreements(ctx) (*V1OmniAIEntitlementGetEntitlementAgreementsResponse, error)` **get** `/v1/omni-ai/entitlement-agreements` List current signable entitlement agreements for consent UX. ### Returns - `type V1OmniAIEntitlementGetEntitlementAgreementsResponse struct{…}` - `Data EntitlementAgreementResourceList` - `AgreementID string` - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `DocumentContent string` - `DocumentSha256 string` - `EntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `Title string` - `Version int64` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Entitlements.GetEntitlementAgreements(context.TODO()) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type DeleteEntitlementResponse struct{…}` - `EntitlementID string` - `Revoked bool` ### Entitlement Agreement Key - `type EntitlementAgreementKey string` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` ### Entitlement Agreement Resource - `type EntitlementAgreementResource struct{…}` - `AgreementID string` - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `DocumentContent string` - `DocumentSha256 string` - `EntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `Title string` - `Version int64` ### Entitlement Agreement Resource List - `type EntitlementAgreementResourceList []EntitlementAgreementResource` - `AgreementID string` - `AgreementKey EntitlementAgreementKey` Stable entitlement agreement family key. - `const EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"` - `DocumentContent string` - `DocumentSha256 string` - `EntitlementCodes []EntitlementCode` - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `Title string` - `Version int64` ### Entitlement Code - `type EntitlementCode string` Stable entitlement code granted by an agreement. - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` ### Entitlement Resource - `type EntitlementResource struct{…}` - `AgreementID string` - `EntitlementCode EntitlementCode` Stable entitlement code granted by an agreement. - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `EntitlementID string` - `GrantedAt string` - `TradingAccountID int64` ### Entitlement Resource List - `type EntitlementResourceList []EntitlementResource` - `AgreementID string` - `EntitlementCode EntitlementCode` Stable entitlement code granted by an agreement. - `const EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"` - `EntitlementID string` - `GrantedAt string` - `TradingAccountID int64` # Messages ## Get Message By ID `client.V1.OmniAI.Messages.GetMessageByID(ctx, messageID, query) (*V1OmniAIMessageGetMessageByIDResponse, error)` **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 - `messageID string` - `query V1OmniAIMessageGetMessageByIDParams` - `AccountID param.Field[int64]` Account ID for the request ### Returns - `type V1OmniAIMessageGetMessageByIDResponse struct{…}` - `Data Message` Final immutable message. - `ID string` - `Content MessageContent` Finalized immutable message content container. Never includes thinking parts. - `Parts []MessageContentPartUnion` - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` - `CreatedAt string` - `Outcome MessageOutcome` Immutable terminal outcome for a finalized assistant message. - `const MessageOutcomeCompleted MessageOutcome = "completed"` - `const MessageOutcomeErrored MessageOutcome = "errored"` - `const MessageOutcomeCanceled MessageOutcome = "canceled"` - `Role MessageRole` Finalized message role in the public contract. - `const MessageRoleUser MessageRole = "USER"` - `const MessageRoleAssistant MessageRole = "ASSISTANT"` - `Seq int64` - `ThreadID string` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Messages.GetMessageByID( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIMessageGetMessageByIDParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Messages.SubmitFeedback(ctx, messageID, body) (*V1OmniAIMessageSubmitFeedbackResponse, error)` **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 - `messageID string` - `body V1OmniAIMessageSubmitFeedbackParams` - `AccountID param.Field[int64]` Account ID for the request - `Score param.Field[int64]` Feedback score (-1, 0, +1 or 1-5) - `Comment param.Field[string]` Optional feedback comment - `Metadata param.Field[any]` Optional metadata ### Returns - `type V1OmniAIMessageSubmitFeedbackResponse struct{…}` - `Data CreateFeedbackResponse` - `CreatedAt string` - `FeedbackID string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Messages.SubmitFeedback( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIMessageSubmitFeedbackParams{ AccountID: 0, Score: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type CreateFeedbackResponse struct{…}` - `CreatedAt string` - `FeedbackID string` # Responses ## Get Response By ID `client.V1.OmniAI.Responses.GetResponseByID(ctx, responseID, query) (*V1OmniAIResponseGetResponseByIDResponse, error)` **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 - `responseID string` - `query V1OmniAIResponseGetResponseByIDParams` - `AccountID param.Field[int64]` Account ID for the request ### Returns - `type V1OmniAIResponseGetResponseByIDResponse struct{…}` - `Data Response` Dynamic pollable response. - `ID string` - `Status ResponseStatus` Dynamic lifecycle status for a pollable response. - `const ResponseStatusQueued ResponseStatus = "queued"` - `const ResponseStatusRunning ResponseStatus = "running"` - `const ResponseStatusSucceeded ResponseStatus = "succeeded"` - `const ResponseStatusFailed ResponseStatus = "failed"` - `const ResponseStatusCanceled ResponseStatus = "canceled"` - `ThreadID string` - `UserMessageID string` - `Content ResponseContent` Dynamic response content container. May include thinking parts. - `Parts []ResponseContentPartUnion` - `type ResponseContentPartObject struct{…}` Text content part. - `Type string` - `const ResponseContentPartObjectTypeText ResponseContentPartObjectType = "text"` - `type ResponseContentPartObject2 struct{…}` Thinking content part shown on dynamic response polling. - `Type string` - `const ResponseContentPartObject2TypeThinking ResponseContentPartObject2Type = "thinking"` - `type ResponseContentPartObject3 struct{…}` Structured action content part. - `Type string` - `const ResponseContentPartObject3TypeStructuredAction ResponseContentPartObject3Type = "structured_action"` - `type ResponseContentPartObject4 struct{…}` Chart payload content part. - `Type string` - `const ResponseContentPartObject4TypeChart ResponseContentPartObject4Type = "chart"` - `type ResponseContentPartObject5 struct{…}` Suggested actions payload content part. - `Type string` - `const ResponseContentPartObject5TypeSuggestedActions ResponseContentPartObject5Type = "suggested_actions"` - `type ResponseContentPartObject6 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const ResponseContentPartObject6TypeCustom ResponseContentPartObject6Type = "custom"` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` - `OutputMessageID string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Responses.GetResponseByID( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIResponseGetResponseByIDParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Responses.CancelResponse(ctx, responseID, body) (*V1OmniAIResponseCancelResponseResponse, error)` **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 - `responseID string` - `body V1OmniAIResponseCancelResponseParams` - `AccountID param.Field[int64]` Account ID for the request ### Returns - `type V1OmniAIResponseCancelResponseResponse struct{…}` - `Data CancelResponsePayload` - `Canceled bool` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Responses.CancelResponse( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIResponseCancelResponseParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": { "canceled": false }, "metadata": { "request_id": "fa26a786-f5d3-48b0-80eb-778e17af4964" } } ``` ## Domain Types ### Cancel Response Payload - `type CancelResponsePayload struct{…}` - `Canceled bool` ### Error Status - `type ErrorStatus struct{…}` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` ### Response - `type Response struct{…}` Dynamic pollable response. - `ID string` - `Status ResponseStatus` Dynamic lifecycle status for a pollable response. - `const ResponseStatusQueued ResponseStatus = "queued"` - `const ResponseStatusRunning ResponseStatus = "running"` - `const ResponseStatusSucceeded ResponseStatus = "succeeded"` - `const ResponseStatusFailed ResponseStatus = "failed"` - `const ResponseStatusCanceled ResponseStatus = "canceled"` - `ThreadID string` - `UserMessageID string` - `Content ResponseContent` Dynamic response content container. May include thinking parts. - `Parts []ResponseContentPartUnion` - `type ResponseContentPartObject struct{…}` Text content part. - `Type string` - `const ResponseContentPartObjectTypeText ResponseContentPartObjectType = "text"` - `type ResponseContentPartObject2 struct{…}` Thinking content part shown on dynamic response polling. - `Type string` - `const ResponseContentPartObject2TypeThinking ResponseContentPartObject2Type = "thinking"` - `type ResponseContentPartObject3 struct{…}` Structured action content part. - `Type string` - `const ResponseContentPartObject3TypeStructuredAction ResponseContentPartObject3Type = "structured_action"` - `type ResponseContentPartObject4 struct{…}` Chart payload content part. - `Type string` - `const ResponseContentPartObject4TypeChart ResponseContentPartObject4Type = "chart"` - `type ResponseContentPartObject5 struct{…}` Suggested actions payload content part. - `Type string` - `const ResponseContentPartObject5TypeSuggestedActions ResponseContentPartObject5Type = "suggested_actions"` - `type ResponseContentPartObject6 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const ResponseContentPartObject6TypeCustom ResponseContentPartObject6Type = "custom"` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` - `OutputMessageID string` ### Response Content - `type ResponseContent struct{…}` Dynamic response content container. May include thinking parts. - `Parts []ResponseContentPartUnion` - `type ResponseContentPartObject struct{…}` Text content part. - `Type string` - `const ResponseContentPartObjectTypeText ResponseContentPartObjectType = "text"` - `type ResponseContentPartObject2 struct{…}` Thinking content part shown on dynamic response polling. - `Type string` - `const ResponseContentPartObject2TypeThinking ResponseContentPartObject2Type = "thinking"` - `type ResponseContentPartObject3 struct{…}` Structured action content part. - `Type string` - `const ResponseContentPartObject3TypeStructuredAction ResponseContentPartObject3Type = "structured_action"` - `type ResponseContentPartObject4 struct{…}` Chart payload content part. - `Type string` - `const ResponseContentPartObject4TypeChart ResponseContentPartObject4Type = "chart"` - `type ResponseContentPartObject5 struct{…}` Suggested actions payload content part. - `Type string` - `const ResponseContentPartObject5TypeSuggestedActions ResponseContentPartObject5Type = "suggested_actions"` - `type ResponseContentPartObject6 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const ResponseContentPartObject6TypeCustom ResponseContentPartObject6Type = "custom"` ### Response Content Part - `type ResponseContentPartUnion interface{…}` Dynamic content part visible on a pollable response. - `type ResponseContentPartObject struct{…}` Text content part. - `Type string` - `const ResponseContentPartObjectTypeText ResponseContentPartObjectType = "text"` - `type ResponseContentPartObject2 struct{…}` Thinking content part shown on dynamic response polling. - `Type string` - `const ResponseContentPartObject2TypeThinking ResponseContentPartObject2Type = "thinking"` - `type ResponseContentPartObject3 struct{…}` Structured action content part. - `Type string` - `const ResponseContentPartObject3TypeStructuredAction ResponseContentPartObject3Type = "structured_action"` - `type ResponseContentPartObject4 struct{…}` Chart payload content part. - `Type string` - `const ResponseContentPartObject4TypeChart ResponseContentPartObject4Type = "chart"` - `type ResponseContentPartObject5 struct{…}` Suggested actions payload content part. - `Type string` - `const ResponseContentPartObject5TypeSuggestedActions ResponseContentPartObject5Type = "suggested_actions"` - `type ResponseContentPartObject6 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const ResponseContentPartObject6TypeCustom ResponseContentPartObject6Type = "custom"` ### Response Status - `type ResponseStatus string` Dynamic lifecycle status for a pollable response. - `const ResponseStatusQueued ResponseStatus = "queued"` - `const ResponseStatusRunning ResponseStatus = "running"` - `const ResponseStatusSucceeded ResponseStatus = "succeeded"` - `const ResponseStatusFailed ResponseStatus = "failed"` - `const ResponseStatusCanceled ResponseStatus = "canceled"` # Threads ## Get Threads `client.V1.OmniAI.Threads.GetThreads(ctx, query) (*V1OmniAIThreadGetThreadsResponse, error)` **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 - `query V1OmniAIThreadGetThreadsParams` - `AccountID param.Field[int64]` Account ID for the request - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1OmniAIThreadGetThreadsResponse struct{…}` - `Data ThreadList` - `ID string` - `CreatedAt string` - `Title string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.GetThreads(context.TODO(), clearstreet.V1OmniAIThreadGetThreadsParams{ AccountID: 0, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Threads.GetThreadByID(ctx, threadID, query) (*V1OmniAIThreadGetThreadByIDResponse, error)` **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 - `threadID string` - `query V1OmniAIThreadGetThreadByIDParams` - `AccountID param.Field[int64]` Account ID for the request ### Returns - `type V1OmniAIThreadGetThreadByIDResponse struct{…}` - `Data Thread` Thread metadata returned by list/get thread endpoints. - `ID string` - `CreatedAt string` - `Title string` - `UpdatedAt string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.GetThreadByID( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIThreadGetThreadByIDParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Threads.NewThread(ctx, body) (*V1OmniAIThreadNewThreadResponse, error)` **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 - `body V1OmniAIThreadNewThreadParams` - `AccountID param.Field[int64]` - `Type param.Field[V1OmniAIThreadNewThreadParamsType]` Thread creation mode. - `const V1OmniAIThreadNewThreadParamsTypeInstant V1OmniAIThreadNewThreadParamsType = "instant"` - `const V1OmniAIThreadNewThreadParamsTypeDeepInsights V1OmniAIThreadNewThreadParamsType = "deep_insights"` - `Capabilities param.Field[[]string]` - `const V1OmniAIThreadNewThreadParamsCapabilityPrefillOrder V1OmniAIThreadNewThreadParamsCapability = "PREFILL_ORDER"` - `const V1OmniAIThreadNewThreadParamsCapabilityOpenChart V1OmniAIThreadNewThreadParamsCapability = "OPEN_CHART"` - `const V1OmniAIThreadNewThreadParamsCapabilityOpenScreener V1OmniAIThreadNewThreadParamsCapability = "OPEN_SCREENER"` - `const V1OmniAIThreadNewThreadParamsCapabilityOpenEntitlementConsent V1OmniAIThreadNewThreadParamsCapability = "OPEN_ENTITLEMENT_CONSENT"` - `Target param.Field[V1OmniAIThreadNewThreadParamsTarget]` Deep-insights target payload. - `Ticker string` - `Type string` Deep-insights target type. Launch supports ticker-only. - `const V1OmniAIThreadNewThreadParamsTargetTypeTicker V1OmniAIThreadNewThreadParamsTargetType = "ticker"` - `Text param.Field[string]` - `Thesis param.Field[string]` ### Returns - `type V1OmniAIThreadNewThreadResponse struct{…}` - `Data CreateThreadResponse` Response payload for thread creation. - `ResponseID string` - `ThreadID string` - `UserMessageID string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.NewThread(context.TODO(), clearstreet.V1OmniAIThreadNewThreadParams{ AccountID: 19816, Type: clearstreet.V1OmniAIThreadNewThreadParamsTypeInstant, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Threads.GetThreadResponse(ctx, threadID, query) (*V1OmniAIThreadGetThreadResponseResponse, error)` **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 - `threadID string` - `query V1OmniAIThreadGetThreadResponseParams` - `AccountID param.Field[int64]` Account ID for the request ### Returns - `type V1OmniAIThreadGetThreadResponseResponse struct{…}` - `Data Response` Dynamic pollable response. - `ID string` - `Status ResponseStatus` Dynamic lifecycle status for a pollable response. - `const ResponseStatusQueued ResponseStatus = "queued"` - `const ResponseStatusRunning ResponseStatus = "running"` - `const ResponseStatusSucceeded ResponseStatus = "succeeded"` - `const ResponseStatusFailed ResponseStatus = "failed"` - `const ResponseStatusCanceled ResponseStatus = "canceled"` - `ThreadID string` - `UserMessageID string` - `Content ResponseContent` Dynamic response content container. May include thinking parts. - `Parts []ResponseContentPartUnion` - `type ResponseContentPartObject struct{…}` Text content part. - `Type string` - `const ResponseContentPartObjectTypeText ResponseContentPartObjectType = "text"` - `type ResponseContentPartObject2 struct{…}` Thinking content part shown on dynamic response polling. - `Type string` - `const ResponseContentPartObject2TypeThinking ResponseContentPartObject2Type = "thinking"` - `type ResponseContentPartObject3 struct{…}` Structured action content part. - `Type string` - `const ResponseContentPartObject3TypeStructuredAction ResponseContentPartObject3Type = "structured_action"` - `type ResponseContentPartObject4 struct{…}` Chart payload content part. - `Type string` - `const ResponseContentPartObject4TypeChart ResponseContentPartObject4Type = "chart"` - `type ResponseContentPartObject5 struct{…}` Suggested actions payload content part. - `Type string` - `const ResponseContentPartObject5TypeSuggestedActions ResponseContentPartObject5Type = "suggested_actions"` - `type ResponseContentPartObject6 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const ResponseContentPartObject6TypeCustom ResponseContentPartObject6Type = "custom"` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` - `OutputMessageID string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.GetThreadResponse( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIThreadGetThreadResponseParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Threads.GetMessages(ctx, threadID, query) (*V1OmniAIThreadGetMessagesResponse, error)` **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 - `threadID string` - `query V1OmniAIThreadGetMessagesParams` - `AccountID param.Field[int64]` Account ID for the request - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1OmniAIThreadGetMessagesResponse struct{…}` - `Data MessageList` - `ID string` - `Content MessageContent` Finalized immutable message content container. Never includes thinking parts. - `Parts []MessageContentPartUnion` - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` - `CreatedAt string` - `Outcome MessageOutcome` Immutable terminal outcome for a finalized assistant message. - `const MessageOutcomeCompleted MessageOutcome = "completed"` - `const MessageOutcomeErrored MessageOutcome = "errored"` - `const MessageOutcomeCanceled MessageOutcome = "canceled"` - `Role MessageRole` Finalized message role in the public contract. - `const MessageRoleUser MessageRole = "USER"` - `const MessageRoleAssistant MessageRole = "ASSISTANT"` - `Seq int64` - `ThreadID string` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.GetMessages( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIThreadGetMessagesParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.OmniAI.Threads.NewMessage(ctx, threadID, body) (*V1OmniAIThreadNewMessageResponse, error)` **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 - `threadID string` - `body V1OmniAIThreadNewMessageParams` - `AccountID param.Field[int64]` - `Text param.Field[string]` - `Capabilities param.Field[[]string]` - `const V1OmniAIThreadNewMessageParamsCapabilityPrefillOrder V1OmniAIThreadNewMessageParamsCapability = "PREFILL_ORDER"` - `const V1OmniAIThreadNewMessageParamsCapabilityOpenChart V1OmniAIThreadNewMessageParamsCapability = "OPEN_CHART"` - `const V1OmniAIThreadNewMessageParamsCapabilityOpenScreener V1OmniAIThreadNewMessageParamsCapability = "OPEN_SCREENER"` - `const V1OmniAIThreadNewMessageParamsCapabilityOpenEntitlementConsent V1OmniAIThreadNewMessageParamsCapability = "OPEN_ENTITLEMENT_CONSENT"` ### Returns - `type V1OmniAIThreadNewMessageResponse struct{…}` - `Data CreateMessageResponse` Response payload for continuing a thread with a new message. - `ResponseID string` - `ThreadID string` - `UserMessageID string` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.OmniAI.Threads.NewMessage( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1OmniAIThreadNewMessageParams{ AccountID: 19816, Text: "Compare that to AMD.", }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type CreateMessageResponse struct{…}` Response payload for continuing a thread with a new message. - `ResponseID string` - `ThreadID string` - `UserMessageID string` ### Create Thread Response - `type CreateThreadResponse struct{…}` Response payload for thread creation. - `ResponseID string` - `ThreadID string` - `UserMessageID string` ### Message - `type Message struct{…}` Final immutable message. - `ID string` - `Content MessageContent` Finalized immutable message content container. Never includes thinking parts. - `Parts []MessageContentPartUnion` - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` - `CreatedAt string` - `Outcome MessageOutcome` Immutable terminal outcome for a finalized assistant message. - `const MessageOutcomeCompleted MessageOutcome = "completed"` - `const MessageOutcomeErrored MessageOutcome = "errored"` - `const MessageOutcomeCanceled MessageOutcome = "canceled"` - `Role MessageRole` Finalized message role in the public contract. - `const MessageRoleUser MessageRole = "USER"` - `const MessageRoleAssistant MessageRole = "ASSISTANT"` - `Seq int64` - `ThreadID string` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` ### Message Content - `type MessageContent struct{…}` Finalized immutable message content container. Never includes thinking parts. - `Parts []MessageContentPartUnion` - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` ### Message Content Part - `type MessageContentPartUnion interface{…}` Final immutable content part visible on persisted messages. - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` ### Message List - `type MessageList []Message` - `ID string` - `Content MessageContent` Finalized immutable message content container. Never includes thinking parts. - `Parts []MessageContentPartUnion` - `type MessageContentPartObject struct{…}` Text content part. - `Type string` - `const MessageContentPartObjectTypeText MessageContentPartObjectType = "text"` - `type MessageContentPartObject2 struct{…}` Structured action content part. - `Type string` - `const MessageContentPartObject2TypeStructuredAction MessageContentPartObject2Type = "structured_action"` - `type MessageContentPartObject3 struct{…}` Chart payload content part. - `Type string` - `const MessageContentPartObject3TypeChart MessageContentPartObject3Type = "chart"` - `type MessageContentPartObject4 struct{…}` Suggested actions payload content part. - `Type string` - `const MessageContentPartObject4TypeSuggestedActions MessageContentPartObject4Type = "suggested_actions"` - `type MessageContentPartObject5 struct{…}` Escape-hatch custom payload content part. - `Type string` - `const MessageContentPartObject5TypeCustom MessageContentPartObject5Type = "custom"` - `CreatedAt string` - `Outcome MessageOutcome` Immutable terminal outcome for a finalized assistant message. - `const MessageOutcomeCompleted MessageOutcome = "completed"` - `const MessageOutcomeErrored MessageOutcome = "errored"` - `const MessageOutcomeCanceled MessageOutcome = "canceled"` - `Role MessageRole` Finalized message role in the public contract. - `const MessageRoleUser MessageRole = "USER"` - `const MessageRoleAssistant MessageRole = "ASSISTANT"` - `Seq int64` - `ThreadID string` - `Error ErrorStatus` Shared sanitized error payload. - `Code string` - `Message string` - `Details any` ### Message Outcome - `type MessageOutcome string` Immutable terminal outcome for a finalized assistant message. - `const MessageOutcomeCompleted MessageOutcome = "completed"` - `const MessageOutcomeErrored MessageOutcome = "errored"` - `const MessageOutcomeCanceled MessageOutcome = "canceled"` ### Message Role - `type MessageRole string` Finalized message role in the public contract. - `const MessageRoleUser MessageRole = "USER"` - `const MessageRoleAssistant MessageRole = "ASSISTANT"` ### Thread - `type Thread struct{…}` Thread metadata returned by list/get thread endpoints. - `ID string` - `CreatedAt string` - `Title string` - `UpdatedAt string` ### Thread List - `type ThreadList []Thread` - `ID string` - `CreatedAt string` - `Title string` - `UpdatedAt string` # Orders ## Get Orders `client.V1.Orders.GetOrders(ctx, accountID, query) (*V1OrderGetOrdersResponse, error)` **get** `/v1/accounts/{account_id}/orders` List orders for an account with optional filtering ### Parameters - `accountID int64` - `query V1OrderGetOrdersParams` - `From param.Field[Time]` The start date and time for the query range, inclusive (ISO 8601 format) - `InstrumentIDs param.Field[[]string]` Comma-separated OEMS instrument UUIDs - `InstrumentType param.Field[V1OrderGetOrdersParamsInstrumentType]` Instrument type filter (e.g., COMMON_STOCK, OPTION) - `const V1OrderGetOrdersParamsInstrumentTypeCommonStock V1OrderGetOrdersParamsInstrumentType = "COMMON_STOCK"` - `const V1OrderGetOrdersParamsInstrumentTypePreferredStock V1OrderGetOrdersParamsInstrumentType = "PREFERRED_STOCK"` - `const V1OrderGetOrdersParamsInstrumentTypeOption V1OrderGetOrdersParamsInstrumentType = "OPTION"` - `const V1OrderGetOrdersParamsInstrumentTypeCash V1OrderGetOrdersParamsInstrumentType = "CASH"` - `const V1OrderGetOrdersParamsInstrumentTypeOther V1OrderGetOrdersParamsInstrumentType = "OTHER"` - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `Status param.Field[[]string]` Comma-separated order statuses to filter by - `const V1OrderGetOrdersParamsStatusPendingNew V1OrderGetOrdersParamsStatus = "PENDING_NEW"` - `const V1OrderGetOrdersParamsStatusNew V1OrderGetOrdersParamsStatus = "NEW"` - `const V1OrderGetOrdersParamsStatusPartiallyFilled V1OrderGetOrdersParamsStatus = "PARTIALLY_FILLED"` - `const V1OrderGetOrdersParamsStatusFilled V1OrderGetOrdersParamsStatus = "FILLED"` - `const V1OrderGetOrdersParamsStatusCanceled V1OrderGetOrdersParamsStatus = "CANCELED"` - `const V1OrderGetOrdersParamsStatusRejected V1OrderGetOrdersParamsStatus = "REJECTED"` - `const V1OrderGetOrdersParamsStatusExpired V1OrderGetOrdersParamsStatus = "EXPIRED"` - `const V1OrderGetOrdersParamsStatusPendingCancel V1OrderGetOrdersParamsStatus = "PENDING_CANCEL"` - `const V1OrderGetOrdersParamsStatusPendingReplace V1OrderGetOrdersParamsStatus = "PENDING_REPLACE"` - `const V1OrderGetOrdersParamsStatusReplaced V1OrderGetOrdersParamsStatus = "REPLACED"` - `const V1OrderGetOrdersParamsStatusDoneForDay V1OrderGetOrdersParamsStatus = "DONE_FOR_DAY"` - `const V1OrderGetOrdersParamsStatusStopped V1OrderGetOrdersParamsStatus = "STOPPED"` - `const V1OrderGetOrdersParamsStatusSuspended V1OrderGetOrdersParamsStatus = "SUSPENDED"` - `const V1OrderGetOrdersParamsStatusCalculated V1OrderGetOrdersParamsStatus = "CALCULATED"` - `const V1OrderGetOrdersParamsStatusOther V1OrderGetOrdersParamsStatus = "OTHER"` - `Symbol param.Field[string]` Filter by symbol - `To param.Field[Time]` The end date and time for the query range, inclusive (ISO 8601 format) - `UnderlyingInstrumentIDs param.Field[string]` Comma-separated OEMS instrument UUIDs. Matches options orders whose resolved underlier is any of the given IDs. ### Returns - `type V1OrderGetOrdersResponse struct{…}` - `Data OrderList` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.GetOrders( context.TODO(), 0, clearstreet.V1OrderGetOrdersParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Orders.GetOrderByID(ctx, orderID, query) (*V1OrderGetOrderByIDResponse, error)` **get** `/v1/accounts/{account_id}/orders/{order_id}` Get Order By ID ### Parameters - `orderID string` - `query V1OrderGetOrderByIDParams` - `AccountID param.Field[int64]` Account identifier ### Returns - `type V1OrderGetOrderByIDResponse struct{…}` - `Data 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. - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.GetOrderByID( context.TODO(), "order_id", clearstreet.V1OrderGetOrderByIDParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Orders.SubmitOrders(ctx, accountID, body) (*V1OrderSubmitOrdersResponse, error)` **post** `/v1/accounts/{account_id}/orders` Submit new orders ### Parameters - `accountID int64` - `body V1OrderSubmitOrdersParams` - `Orders param.Field[[]V1OrderSubmitOrdersParamsOrderUnion]` - `type V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest struct{…}` Multileg strategy order request - `Legs []V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg` Legs that compose the strategy. - `InstrumentType SecurityType` Security type for the leg. - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `Ratio string` Ratio for the leg. - `Security string` Trading symbol (e.g. "AAPL" or OSI symbol for options) - `Side Side` Leg side. - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `ID string` Optional leg reference identifier. - `PositionEffect PositionEffect` Optional leg position effect. - `const PositionEffectOpen PositionEffect = "OPEN"` - `const PositionEffectClose PositionEffect = "CLOSE"` - `OrderType RequestOrderType` Type of order (currently MARKET or LIMIT for multileg strategy submission) - `const RequestOrderTypeMarket RequestOrderType = "MARKET"` - `const RequestOrderTypeLimit RequestOrderType = "LIMIT"` - `const RequestOrderTypeStop RequestOrderType = "STOP"` - `const RequestOrderTypeStopLimit RequestOrderType = "STOP_LIMIT"` - `const RequestOrderTypeTrailingStop RequestOrderType = "TRAILING_STOP"` - `const RequestOrderTypeTrailingStopLimit RequestOrderType = "TRAILING_STOP_LIMIT"` - `TimeInForce RequestTimeInForce` Time in force - `const RequestTimeInForceDay RequestTimeInForce = "DAY"` - `const RequestTimeInForceGoodTillCancel RequestTimeInForce = "GOOD_TILL_CANCEL"` - `const RequestTimeInForceImmediateOrCancel RequestTimeInForce = "IMMEDIATE_OR_CANCEL"` - `const RequestTimeInForceFillOrKill RequestTimeInForce = "FILL_OR_KILL"` - `const RequestTimeInForceGoodTillDate RequestTimeInForce = "GOOD_TILL_DATE"` - `const RequestTimeInForceAtTheOpening RequestTimeInForce = "AT_THE_OPENING"` - `const RequestTimeInForceAtTheClose RequestTimeInForce = "AT_THE_CLOSE"` - `const RequestTimeInForceGoodTillCrossing RequestTimeInForce = "GOOD_TILL_CROSSING"` - `const RequestTimeInForceGoodThroughCrossing RequestTimeInForce = "GOOD_THROUGH_CROSSING"` - `const RequestTimeInForceAtCrossing RequestTimeInForce = "AT_CROSSING"` - `ID string` Optional client-provided unique ID (idempotency). Required to be unique per account. - `LimitPrice string` Strategy price, required for LIMIT orders. - `Quantity string` Optional strategy-level quantity. Multiplies leg quantities. Defaults to 1. - `type NewOrderRequest struct{…}` Request to submit a new order (PlaceOrderRequest from spec) - `InstrumentType SecurityType` Type of security - `OrderType RequestOrderType` Type of order - `Quantity string` 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 - `TimeInForce RequestTimeInForce` Time in force - `ID string` Optional client-provided unique ID (idempotency). Required to be unique per account. - `ExpiresAt Time` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (required for LIMIT and STOP_LIMIT orders) - `PositionEffect PositionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `StopPrice string` Stop price (required for STOP and STOP_LIMIT orders) - `Symbol string` 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. - `TrailingOffset string` Trailing offset amount (required for trailing orders) - `TrailingOffsetType TrailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` ### Returns - `type V1OrderSubmitOrdersResponse struct{…}` - `Data OrderList` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.SubmitOrders( context.TODO(), 0, clearstreet.V1OrderSubmitOrdersParams{ Orders: []clearstreet.V1OrderSubmitOrdersParamsOrderUnion{clearstreet.V1OrderSubmitOrdersParamsOrderUnion{ OfV1OrderSubmitOrderssOrderNewOrderMultilegRequest: &clearstreet.V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest{ Legs: []clearstreet.V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg{clearstreet.V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg{ InstrumentType: clearstreet.SecurityTypeOption, Ratio: "ratio", Security: "0193bb84-447a-706f-996f-097254663f02", Side: clearstreet.SideBuy, }, clearstreet.V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg{ InstrumentType: clearstreet.SecurityTypeOption, Ratio: "ratio", Security: "0193bb84-4db4-78ec-b4fd-cba8be61cf8a", Side: clearstreet.SideSell, }, clearstreet.V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg{ InstrumentType: clearstreet.SecurityTypeOption, Ratio: "ratio", Security: "0193bb84-5264-7f20-8fd3-35df82cd6ef0", Side: clearstreet.SideBuy, }}, OrderType: clearstreet.RequestOrderTypeLimit, TimeInForce: clearstreet.RequestTimeInForceDay, }, }}, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Orders.ReplaceOrder(ctx, orderID, params) (*V1OrderReplaceOrderResponse, error)` **patch** `/v1/accounts/{account_id}/orders/{order_id}` Replace an order with new parameters ### Parameters - `orderID string` - `params V1OrderReplaceOrderParams` - `AccountID param.Field[int64]` Path param: Account identifier - `LimitPrice param.Field[string]` Body param: New limit price for the order - `Quantity param.Field[string]` Body param: New quantity for the order - `StopPrice param.Field[string]` Body param: New stop price for the order - `TimeInForce param.Field[RequestTimeInForce]` Body param: New time in force for the order ### Returns - `type V1OrderReplaceOrderResponse struct{…}` - `Data 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. - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.ReplaceOrder( context.TODO(), "order_id", clearstreet.V1OrderReplaceOrderParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Orders.CancelOpenOrder(ctx, orderID, body) (*V1OrderCancelOpenOrderResponse, error)` **delete** `/v1/accounts/{account_id}/orders/{order_id}` Cancel a specific order ### Parameters - `orderID string` - `body V1OrderCancelOpenOrderParams` - `AccountID param.Field[int64]` Account identifier ### Returns - `type V1OrderCancelOpenOrderResponse struct{…}` - `Data 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. - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.CancelOpenOrder( context.TODO(), "order_id", clearstreet.V1OrderCancelOpenOrderParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Orders.CancelAllOpenOrders(ctx, accountID, body) (*V1OrderCancelAllOpenOrdersResponse, error)` **delete** `/v1/accounts/{account_id}/orders` Cancel all orders for an account ### Parameters - `accountID int64` - `body V1OrderCancelAllOpenOrdersParams` - `InstrumentIDs param.Field[[]string]` Comma-separated OEMS instrument UUIDs - `InstrumentType param.Field[V1OrderCancelAllOpenOrdersParamsInstrumentType]` Filter by instrument type (e.g., COMMON_STOCK, OPTION) - `const V1OrderCancelAllOpenOrdersParamsInstrumentTypeCommonStock V1OrderCancelAllOpenOrdersParamsInstrumentType = "COMMON_STOCK"` - `const V1OrderCancelAllOpenOrdersParamsInstrumentTypePreferredStock V1OrderCancelAllOpenOrdersParamsInstrumentType = "PREFERRED_STOCK"` - `const V1OrderCancelAllOpenOrdersParamsInstrumentTypeOption V1OrderCancelAllOpenOrdersParamsInstrumentType = "OPTION"` - `const V1OrderCancelAllOpenOrdersParamsInstrumentTypeCash V1OrderCancelAllOpenOrdersParamsInstrumentType = "CASH"` - `const V1OrderCancelAllOpenOrdersParamsInstrumentTypeOther V1OrderCancelAllOpenOrdersParamsInstrumentType = "OTHER"` - `Side param.Field[V1OrderCancelAllOpenOrdersParamsSide]` Filter by order side (BUY or SELL) - `const V1OrderCancelAllOpenOrdersParamsSideBuy V1OrderCancelAllOpenOrdersParamsSide = "BUY"` - `const V1OrderCancelAllOpenOrdersParamsSideSell V1OrderCancelAllOpenOrdersParamsSide = "SELL"` - `const V1OrderCancelAllOpenOrdersParamsSideSellShort V1OrderCancelAllOpenOrdersParamsSide = "SELL_SHORT"` - `const V1OrderCancelAllOpenOrdersParamsSideOther V1OrderCancelAllOpenOrdersParamsSide = "OTHER"` - `Type param.Field[V1OrderCancelAllOpenOrdersParamsType]` Filter by order type (e.g., MARKET, LIMIT) - `const V1OrderCancelAllOpenOrdersParamsTypeMarket V1OrderCancelAllOpenOrdersParamsType = "MARKET"` - `const V1OrderCancelAllOpenOrdersParamsTypeLimit V1OrderCancelAllOpenOrdersParamsType = "LIMIT"` - `const V1OrderCancelAllOpenOrdersParamsTypeStop V1OrderCancelAllOpenOrdersParamsType = "STOP"` - `const V1OrderCancelAllOpenOrdersParamsTypeStopLimit V1OrderCancelAllOpenOrdersParamsType = "STOP_LIMIT"` - `const V1OrderCancelAllOpenOrdersParamsTypeTrailingStop V1OrderCancelAllOpenOrdersParamsType = "TRAILING_STOP"` - `const V1OrderCancelAllOpenOrdersParamsTypeTrailingStopLimit V1OrderCancelAllOpenOrdersParamsType = "TRAILING_STOP_LIMIT"` - `const V1OrderCancelAllOpenOrdersParamsTypeOther V1OrderCancelAllOpenOrdersParamsType = "OTHER"` ### Returns - `type V1OrderCancelAllOpenOrdersResponse struct{…}` - `Data OrderList` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Orders.CancelAllOpenOrders( context.TODO(), 0, clearstreet.V1OrderCancelAllOpenOrdersParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type CancelOrderRequest struct{…}` 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. - `AccountID int64` Account ID (from path parameter) - `OrderID string` Order ID to cancel (from path parameter) ### Instrument ID Or Symbol - `type InstrumentIDOrSymbol string` OEMS instrument UUID ### New Order Request - `type NewOrderRequest struct{…}` Request to submit a new order (PlaceOrderRequest from spec) - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `OrderType RequestOrderType` Type of order - `const RequestOrderTypeMarket RequestOrderType = "MARKET"` - `const RequestOrderTypeLimit RequestOrderType = "LIMIT"` - `const RequestOrderTypeStop RequestOrderType = "STOP"` - `const RequestOrderTypeStopLimit RequestOrderType = "STOP_LIMIT"` - `const RequestOrderTypeTrailingStop RequestOrderType = "TRAILING_STOP"` - `const RequestOrderTypeTrailingStopLimit RequestOrderType = "TRAILING_STOP_LIMIT"` - `Quantity string` 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 - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `TimeInForce RequestTimeInForce` Time in force - `const RequestTimeInForceDay RequestTimeInForce = "DAY"` - `const RequestTimeInForceGoodTillCancel RequestTimeInForce = "GOOD_TILL_CANCEL"` - `const RequestTimeInForceImmediateOrCancel RequestTimeInForce = "IMMEDIATE_OR_CANCEL"` - `const RequestTimeInForceFillOrKill RequestTimeInForce = "FILL_OR_KILL"` - `const RequestTimeInForceGoodTillDate RequestTimeInForce = "GOOD_TILL_DATE"` - `const RequestTimeInForceAtTheOpening RequestTimeInForce = "AT_THE_OPENING"` - `const RequestTimeInForceAtTheClose RequestTimeInForce = "AT_THE_CLOSE"` - `const RequestTimeInForceGoodTillCrossing RequestTimeInForce = "GOOD_TILL_CROSSING"` - `const RequestTimeInForceGoodThroughCrossing RequestTimeInForce = "GOOD_THROUGH_CROSSING"` - `const RequestTimeInForceAtCrossing RequestTimeInForce = "AT_CROSSING"` - `ID string` Optional client-provided unique ID (idempotency). Required to be unique per account. - `ExpiresAt Time` The timestamp when the order should expire (UTC). Required when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Allow trading outside regular trading hours. Some brokers disallow options outside RTH. - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (required for LIMIT and STOP_LIMIT orders) - `PositionEffect PositionEffect` Required when instrument_type is OPTION. Specifies whether the order opens or closes a position. - `const PositionEffectOpen PositionEffect = "OPEN"` - `const PositionEffectClose PositionEffect = "CLOSE"` - `StopPrice string` Stop price (required for STOP and STOP_LIMIT orders) - `Symbol string` 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. - `TrailingOffset string` Trailing offset amount (required for trailing orders) - `TrailingOffsetType TrailingOffsetType` Trailing offset type (PRICE or PERCENT_BPS) - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` ### Order - `type Order struct{…}` 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. - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 List - `type OrderList []Order` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 - `type OrderStatus string` Order status - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` ### Order Type - `type OrderType string` Order type - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` ### Position Effect - `type PositionEffect string` Position effect for options orders - `const PositionEffectOpen PositionEffect = "OPEN"` - `const PositionEffectClose PositionEffect = "CLOSE"` ### Queue State - `type QueueState string` Parent order queue or hold state. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` ### Request Order Type - `type RequestOrderType string` Strict order-type enum for order submission/replacement requests. - `const RequestOrderTypeMarket RequestOrderType = "MARKET"` - `const RequestOrderTypeLimit RequestOrderType = "LIMIT"` - `const RequestOrderTypeStop RequestOrderType = "STOP"` - `const RequestOrderTypeStopLimit RequestOrderType = "STOP_LIMIT"` - `const RequestOrderTypeTrailingStop RequestOrderType = "TRAILING_STOP"` - `const RequestOrderTypeTrailingStopLimit RequestOrderType = "TRAILING_STOP_LIMIT"` ### Request Time In Force - `type RequestTimeInForce string` Strict time-in-force enum for order submission/replacement requests. - `const RequestTimeInForceDay RequestTimeInForce = "DAY"` - `const RequestTimeInForceGoodTillCancel RequestTimeInForce = "GOOD_TILL_CANCEL"` - `const RequestTimeInForceImmediateOrCancel RequestTimeInForce = "IMMEDIATE_OR_CANCEL"` - `const RequestTimeInForceFillOrKill RequestTimeInForce = "FILL_OR_KILL"` - `const RequestTimeInForceGoodTillDate RequestTimeInForce = "GOOD_TILL_DATE"` - `const RequestTimeInForceAtTheOpening RequestTimeInForce = "AT_THE_OPENING"` - `const RequestTimeInForceAtTheClose RequestTimeInForce = "AT_THE_CLOSE"` - `const RequestTimeInForceGoodTillCrossing RequestTimeInForce = "GOOD_TILL_CROSSING"` - `const RequestTimeInForceGoodThroughCrossing RequestTimeInForce = "GOOD_THROUGH_CROSSING"` - `const RequestTimeInForceAtCrossing RequestTimeInForce = "AT_CROSSING"` ### Side - `type Side string` Side of an order - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` ### Time In Force - `type TimeInForce string` Time in force - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` ### Trailing Offset Type - `type TrailingOffsetType string` Trailing offset type for trailing stop orders. - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` # Positions ## Get Positions `client.V1.Positions.GetPositions(ctx, accountID, query) (*V1PositionGetPositionsResponse, error)` **get** `/v1/accounts/{account_id}/positions` Retrieves all positions for the specified trading account. ### Parameters - `accountID int64` - `query V1PositionGetPositionsParams` - `InstrumentIDs param.Field[[]string]` Comma-separated OEMS instrument UUIDs - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. - `SortBy param.Field[V1PositionGetPositionsParamsSortBy]` Field to sort by - `const V1PositionGetPositionsParamsSortBySymbol V1PositionGetPositionsParamsSortBy = "SYMBOL"` - `const V1PositionGetPositionsParamsSortByInstrumentType V1PositionGetPositionsParamsSortBy = "INSTRUMENT_TYPE"` - `const V1PositionGetPositionsParamsSortByQuantity V1PositionGetPositionsParamsSortBy = "QUANTITY"` - `const V1PositionGetPositionsParamsSortByMarketValue V1PositionGetPositionsParamsSortBy = "MARKET_VALUE"` - `const V1PositionGetPositionsParamsSortByPositionType V1PositionGetPositionsParamsSortBy = "POSITION_TYPE"` - `const V1PositionGetPositionsParamsSortByUnrealizedPnl V1PositionGetPositionsParamsSortBy = "UNREALIZED_PNL"` - `const V1PositionGetPositionsParamsSortByDailyUnrealizedPnl V1PositionGetPositionsParamsSortBy = "DAILY_UNREALIZED_PNL"` - `SortDirection param.Field[V1PositionGetPositionsParamsSortDirection]` Sort direction - `const V1PositionGetPositionsParamsSortDirectionAsc V1PositionGetPositionsParamsSortDirection = "ASC"` - `const V1PositionGetPositionsParamsSortDirectionDesc V1PositionGetPositionsParamsSortDirection = "DESC"` ### Returns - `type V1PositionGetPositionsResponse struct{…}` - `Data PositionList` - `AccountID int64` The account this position belongs to - `AvailableQuantity string` The quantity of a position that is free to be operated on. - `InstrumentID string` OEMS instrument UUID - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `MarketValue string` The current market value of the position - `PositionType PositionType` The type of position - `const PositionTypeLong PositionType = "LONG"` - `const PositionTypeShort PositionType = "SHORT"` - `const PositionTypeLongCall PositionType = "LONG_CALL"` - `const PositionTypeShortCall PositionType = "SHORT_CALL"` - `const PositionTypeLongPut PositionType = "LONG_PUT"` - `const PositionTypeShortPut PositionType = "SHORT_PUT"` - `Quantity string` The number of shares or contracts. Can be positive (long) or negative (short) - `Symbol string` The trading symbol for the instrument - `AvgPrice string` The average price paid per share or contract for this position - `ClosingPrice string` The closing price used to value the position for the last trading day - `ClosingPriceDate Time` The market date associated with `closing_price` - `CostBasis string` The total cost basis for this position - `DailyUnrealizedPnl string` The unrealized profit or loss for this position relative to the previous close - `DailyUnrealizedPnlPct string` The unrealized profit/loss for the position for the current day, expressed as a percentage of the baseline value (range: 0-100). - `InstrumentPrice string` The current market price of the instrument - `UnderlyingInstrumentID string` OEMS instrument identifier of the underlying instrument, if resolvable - `UnrealizedPnl string` The total unrealized profit or loss for this position based on current market value - `UnrealizedPnlPct string` The unrealized profit/loss for the position, expressed as a percentage of the position's cost basis (range: 0-100). ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.GetPositions( context.TODO(), 0, clearstreet.V1PositionGetPositionsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Positions.ClosePositions(ctx, accountID, body) (*V1PositionClosePositionsResponse, error)` **delete** `/v1/accounts/{account_id}/positions` Delete all positions within an account. Closes all positions for the specified trading account. ### Parameters - `accountID int64` - `body V1PositionClosePositionsParams` - `CancelOrders param.Field[bool]` Whether to cancel existing open orders for the position before submitting closing orders. ### Returns - `type V1PositionClosePositionsResponse struct{…}` - `Data OrderList` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.ClosePositions( context.TODO(), 0, clearstreet.V1PositionClosePositionsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Positions.ClosePosition(ctx, instrumentID, params) (*V1PositionClosePositionResponse, error)` **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 - `InstrumentID InstrumentIDOrSymbol` OEMS instrument UUID - `params V1PositionClosePositionParams` - `AccountID param.Field[int64]` Path param: Account identifier - `CancelOrders param.Field[bool]` Body param: Whether to cancel existing open orders for the position before submitting closing orders. ### Returns - `type V1PositionClosePositionResponse struct{…}` - `Data OrderList` - `ID string` Engine-assigned unique identifier for this order (UUID). - `AccountID int64` Account placing the order - `ClientOrderID string` Client-provided identifier echoed back (FIX tag 11). - `CreatedAt Time` Timestamp when order was created (UTC) - `FilledQuantity string` Cumulative filled quantity - `InstrumentID string` OEMS instrument UUID for the traded instrument. - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LeavesQuantity string` Remaining unfilled quantity - `OrderType OrderType` Type of order (MARKET, LIMIT, etc.) - `const OrderTypeMarket OrderType = "MARKET"` - `const OrderTypeLimit OrderType = "LIMIT"` - `const OrderTypeStop OrderType = "STOP"` - `const OrderTypeStopLimit OrderType = "STOP_LIMIT"` - `const OrderTypeTrailingStop OrderType = "TRAILING_STOP"` - `const OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"` - `const OrderTypeOther OrderType = "OTHER"` - `Quantity string` Total order quantity - `Side Side` Side of the order (BUY, SELL, SELL_SHORT) - `const SideBuy Side = "BUY"` - `const SideSell Side = "SELL"` - `const SideSellShort Side = "SELL_SHORT"` - `const SideOther Side = "OTHER"` - `Status OrderStatus` Current status of the order - `const OrderStatusPendingNew OrderStatus = "PENDING_NEW"` - `const OrderStatusNew OrderStatus = "NEW"` - `const OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"` - `const OrderStatusFilled OrderStatus = "FILLED"` - `const OrderStatusCanceled OrderStatus = "CANCELED"` - `const OrderStatusRejected OrderStatus = "REJECTED"` - `const OrderStatusExpired OrderStatus = "EXPIRED"` - `const OrderStatusPendingCancel OrderStatus = "PENDING_CANCEL"` - `const OrderStatusPendingReplace OrderStatus = "PENDING_REPLACE"` - `const OrderStatusReplaced OrderStatus = "REPLACED"` - `const OrderStatusDoneForDay OrderStatus = "DONE_FOR_DAY"` - `const OrderStatusStopped OrderStatus = "STOPPED"` - `const OrderStatusSuspended OrderStatus = "SUSPENDED"` - `const OrderStatusCalculated OrderStatus = "CALCULATED"` - `const OrderStatusOther OrderStatus = "OTHER"` - `Symbol string` Trading symbol - `TimeInForce TimeInForce` Time in force instruction - `const TimeInForceDay TimeInForce = "DAY"` - `const TimeInForceGoodTillCancel TimeInForce = "GOOD_TILL_CANCEL"` - `const TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"` - `const TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"` - `const TimeInForceGoodTillDate TimeInForce = "GOOD_TILL_DATE"` - `const TimeInForceAtTheOpening TimeInForce = "AT_THE_OPENING"` - `const TimeInForceAtTheClose TimeInForce = "AT_THE_CLOSE"` - `const TimeInForceGoodTillCrossing TimeInForce = "GOOD_TILL_CROSSING"` - `const TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"` - `const TimeInForceAtCrossing TimeInForce = "AT_CROSSING"` - `const TimeInForceOther TimeInForce = "OTHER"` - `UpdatedAt Time` Timestamp of the most recent update (UTC) - `Venue string` MIC code of the venue where the order is routed - `AverageFillPrice string` Average fill price across all executions - `Details []string` Contains execution, rejection or cancellation details, if any - `ExpiresAt Time` Timestamp when the order will expire (UTC). Present when time_in_force is GOOD_TILL_DATE. - `ExtendedHours bool` Whether the order is eligible for extended-hours trading. - `LimitOffset string` Limit offset for trailing stop-limit orders (signed) - `LimitPrice string` Limit price (for LIMIT and STOP_LIMIT orders) - `QueueState QueueState` Parent order queue state, present when the order is awaiting release or released. - `const QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"` - `const QueueStateReleased QueueState = "RELEASED"` - `ReleasesAt Time` Scheduled release time for orders awaiting release. - `StopPrice string` Stop price (for STOP and STOP_LIMIT orders) - `TrailingLimitPx string` Current trailing limit price computed by the trailing strategy - `TrailingOffset string` Trailing offset amount for trailing orders - `TrailingOffsetType TrailingOffsetType` Trailing offset type for trailing orders - `const TrailingOffsetTypePrice TrailingOffsetType = "PRICE"` - `const TrailingOffsetTypeBps TrailingOffsetType = "BPS"` - `TrailingStopPx string` Current trailing stop price computed by the trailing strategy - `TrailingWatermarkPx string` Trailing watermark price for trailing orders - `TrailingWatermarkTs Time` Trailing watermark timestamp for trailing orders - `UnderlyingInstrumentID string` 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 ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.ClosePosition( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1PositionClosePositionParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Positions.GetPositionInstructions(ctx, accountID, query) (*V1PositionGetPositionInstructionsResponse, error)` **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 - `accountID int64` - `query V1PositionGetPositionInstructionsParams` - `InstrumentID param.Field[InstrumentIDOrSymbol]` Limit results to a single contract. Accepts the instrument id or the OSI symbol. ### Returns - `type V1PositionGetPositionInstructionsResponse struct{…}` - `Data PositionInstructionList` - `ID string` Server-assigned id. Used as the path parameter on cancel. - `AccountID int64` Account the instruction belongs to. - `InstructionID string` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `InstructionType PositionInstructionType` The action this instruction requests. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract this instruction acts on. - `Quantity string` Number of contracts included in the instruction. - `Status PositionInstructionStatus` Current lifecycle status. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` - `Symbol string` Options symbol (OSI) for display. - `AcceptedQuantity string` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `CreatedAt Time` When the instruction was first accepted by the service. - `RejectionReason string` 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. - `UpdatedAt Time` When the instruction's lifecycle state last changed. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.GetPositionInstructions( context.TODO(), 0, clearstreet.V1PositionGetPositionInstructionsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Positions.SubmitPositionInstructions(ctx, accountID, body) (*V1PositionSubmitPositionInstructionsResponse, error)` **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 - `accountID int64` - `body V1PositionSubmitPositionInstructionsParams` - `Instructions param.Field[[]V1PositionSubmitPositionInstructionsParamsInstruction]` - `InstructionType PositionInstructionType` The action to take. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract to act on. Unknown ids return 404. - `Quantity string` Number of contracts to include in the instruction. - `InstructionID string` Caller-supplied idempotency key. Echoed on the response. The server generates a unique id when omitted. ### Returns - `type V1PositionSubmitPositionInstructionsResponse struct{…}` - `Data PositionInstructionList` - `ID string` Server-assigned id. Used as the path parameter on cancel. - `AccountID int64` Account the instruction belongs to. - `InstructionID string` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `InstructionType PositionInstructionType` The action this instruction requests. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract this instruction acts on. - `Quantity string` Number of contracts included in the instruction. - `Status PositionInstructionStatus` Current lifecycle status. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` - `Symbol string` Options symbol (OSI) for display. - `AcceptedQuantity string` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `CreatedAt Time` When the instruction was first accepted by the service. - `RejectionReason string` 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. - `UpdatedAt Time` When the instruction's lifecycle state last changed. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.SubmitPositionInstructions( context.TODO(), 0, clearstreet.V1PositionSubmitPositionInstructionsParams{ Instructions: []clearstreet.V1PositionSubmitPositionInstructionsParamsInstruction{clearstreet.V1PositionSubmitPositionInstructionsParamsInstruction{ InstructionType: clearstreet.PositionInstructionTypeExercise, InstrumentID: "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e02", Quantity: "1", }}, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Positions.CancelPositionInstruction(ctx, instructionID, body) (*V1PositionCancelPositionInstructionResponse, error)` **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 - `instructionID string` - `body V1PositionCancelPositionInstructionParams` - `AccountID param.Field[int64]` Account identifier ### Returns - `type V1PositionCancelPositionInstructionResponse struct{…}` - `Data PositionInstruction` A position instruction and its current lifecycle state. - `ID string` Server-assigned id. Used as the path parameter on cancel. - `AccountID int64` Account the instruction belongs to. - `InstructionID string` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `InstructionType PositionInstructionType` The action this instruction requests. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract this instruction acts on. - `Quantity string` Number of contracts included in the instruction. - `Status PositionInstructionStatus` Current lifecycle status. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` - `Symbol string` Options symbol (OSI) for display. - `AcceptedQuantity string` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `CreatedAt Time` When the instruction was first accepted by the service. - `RejectionReason string` 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. - `UpdatedAt Time` When the instruction's lifecycle state last changed. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Positions.CancelPositionInstruction( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", clearstreet.V1PositionCancelPositionInstructionParams{ AccountID: 0, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 - `type Position struct{…}` Represents a holding of a particular instrument in an account - `AccountID int64` The account this position belongs to - `AvailableQuantity string` The quantity of a position that is free to be operated on. - `InstrumentID string` OEMS instrument UUID - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `MarketValue string` The current market value of the position - `PositionType PositionType` The type of position - `const PositionTypeLong PositionType = "LONG"` - `const PositionTypeShort PositionType = "SHORT"` - `const PositionTypeLongCall PositionType = "LONG_CALL"` - `const PositionTypeShortCall PositionType = "SHORT_CALL"` - `const PositionTypeLongPut PositionType = "LONG_PUT"` - `const PositionTypeShortPut PositionType = "SHORT_PUT"` - `Quantity string` The number of shares or contracts. Can be positive (long) or negative (short) - `Symbol string` The trading symbol for the instrument - `AvgPrice string` The average price paid per share or contract for this position - `ClosingPrice string` The closing price used to value the position for the last trading day - `ClosingPriceDate Time` The market date associated with `closing_price` - `CostBasis string` The total cost basis for this position - `DailyUnrealizedPnl string` The unrealized profit or loss for this position relative to the previous close - `DailyUnrealizedPnlPct string` The unrealized profit/loss for the position for the current day, expressed as a percentage of the baseline value (range: 0-100). - `InstrumentPrice string` The current market price of the instrument - `UnderlyingInstrumentID string` OEMS instrument identifier of the underlying instrument, if resolvable - `UnrealizedPnl string` The total unrealized profit or loss for this position based on current market value - `UnrealizedPnlPct string` The unrealized profit/loss for the position, expressed as a percentage of the position's cost basis (range: 0-100). ### Position Instruction - `type PositionInstruction struct{…}` A position instruction and its current lifecycle state. - `ID string` Server-assigned id. Used as the path parameter on cancel. - `AccountID int64` Account the instruction belongs to. - `InstructionID string` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `InstructionType PositionInstructionType` The action this instruction requests. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract this instruction acts on. - `Quantity string` Number of contracts included in the instruction. - `Status PositionInstructionStatus` Current lifecycle status. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` - `Symbol string` Options symbol (OSI) for display. - `AcceptedQuantity string` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `CreatedAt Time` When the instruction was first accepted by the service. - `RejectionReason string` 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. - `UpdatedAt Time` When the instruction's lifecycle state last changed. ### Position Instruction List - `type PositionInstructionList []PositionInstruction` - `ID string` Server-assigned id. Used as the path parameter on cancel. - `AccountID int64` Account the instruction belongs to. - `InstructionID string` Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied. - `InstructionType PositionInstructionType` The action this instruction requests. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` - `InstrumentID string` Identifier of the options contract this instruction acts on. - `Quantity string` Number of contracts included in the instruction. - `Status PositionInstructionStatus` Current lifecycle status. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` - `Symbol string` Options symbol (OSI) for display. - `AcceptedQuantity string` Number of contracts accepted by the clearing venue. Populated once the instruction reaches `ACCEPTED`. - `CreatedAt Time` When the instruction was first accepted by the service. - `RejectionReason string` 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. - `UpdatedAt Time` When the instruction's lifecycle state last changed. ### Position Instruction Status - `type PositionInstructionStatus string` Lifecycle status of a position instruction. - `const PositionInstructionStatusSent PositionInstructionStatus = "SENT"` - `const PositionInstructionStatusAccepted PositionInstructionStatus = "ACCEPTED"` - `const PositionInstructionStatusRejected PositionInstructionStatus = "REJECTED"` - `const PositionInstructionStatusEngineRejected PositionInstructionStatus = "ENGINE_REJECTED"` - `const PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"` - `const PositionInstructionStatusCancelled PositionInstructionStatus = "CANCELLED"` - `const PositionInstructionStatusCancelFailed PositionInstructionStatus = "CANCEL_FAILED"` - `const PositionInstructionStatusUnknown PositionInstructionStatus = "UNKNOWN"` ### Position Instruction Type - `type PositionInstructionType string` The action to take against an options position. - `const PositionInstructionTypeExercise PositionInstructionType = "EXERCISE"` - `const PositionInstructionTypeDoNotExercise PositionInstructionType = "DO_NOT_EXERCISE"` - `const PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"` ### Position List - `type PositionList []Position` - `AccountID int64` The account this position belongs to - `AvailableQuantity string` The quantity of a position that is free to be operated on. - `InstrumentID string` OEMS instrument UUID - `InstrumentType SecurityType` Type of security - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `MarketValue string` The current market value of the position - `PositionType PositionType` The type of position - `const PositionTypeLong PositionType = "LONG"` - `const PositionTypeShort PositionType = "SHORT"` - `const PositionTypeLongCall PositionType = "LONG_CALL"` - `const PositionTypeShortCall PositionType = "SHORT_CALL"` - `const PositionTypeLongPut PositionType = "LONG_PUT"` - `const PositionTypeShortPut PositionType = "SHORT_PUT"` - `Quantity string` The number of shares or contracts. Can be positive (long) or negative (short) - `Symbol string` The trading symbol for the instrument - `AvgPrice string` The average price paid per share or contract for this position - `ClosingPrice string` The closing price used to value the position for the last trading day - `ClosingPriceDate Time` The market date associated with `closing_price` - `CostBasis string` The total cost basis for this position - `DailyUnrealizedPnl string` The unrealized profit or loss for this position relative to the previous close - `DailyUnrealizedPnlPct string` The unrealized profit/loss for the position for the current day, expressed as a percentage of the baseline value (range: 0-100). - `InstrumentPrice string` The current market price of the instrument - `UnderlyingInstrumentID string` OEMS instrument identifier of the underlying instrument, if resolvable - `UnrealizedPnl string` The total unrealized profit or loss for this position based on current market value - `UnrealizedPnlPct string` The unrealized profit/loss for the position, expressed as a percentage of the position's cost basis (range: 0-100). ### Position Type - `type PositionType string` Position type classification - `const PositionTypeLong PositionType = "LONG"` - `const PositionTypeShort PositionType = "SHORT"` - `const PositionTypeLongCall PositionType = "LONG_CALL"` - `const PositionTypeShortCall PositionType = "SHORT_CALL"` - `const PositionTypeLongPut PositionType = "LONG_PUT"` - `const PositionTypeShortPut PositionType = "SHORT_PUT"` # Watchlist ## Get Watchlists `client.V1.Watchlist.GetWatchlists(ctx, query) (*V1WatchlistGetWatchlistsResponse, error)` **get** `/v1/watchlists` List watchlists for the authenticated user ### Parameters - `query V1WatchlistGetWatchlistsParams` - `PageSize param.Field[int64]` The number of items to return per page. Only used when page_token is not provided. - `PageToken param.Field[string]` Token for retrieving the next or previous page of results. Contains encoded pagination state; when provided, page_size is ignored. ### Returns - `type V1WatchlistGetWatchlistsResponse struct{…}` - `Data WatchlistEntryList` - `ID string` The unique identifier for the watchlist. - `CreatedAt Time` The timestamp when the watchlist was created. - `Name string` The user-provided watchlist name. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.GetWatchlists(context.TODO(), clearstreet.V1WatchlistGetWatchlistsParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Watchlist.GetWatchlistByID(ctx, watchlistID) (*V1WatchlistGetWatchlistByIDResponse, error)` **get** `/v1/watchlists/{watchlist_id}` Get a watchlist by ID with all its items ### Parameters - `watchlistID string` ### Returns - `type V1WatchlistGetWatchlistByIDResponse struct{…}` - `Data WatchlistDetail` Detailed watchlist with all items - `ID string` Watchlist ID - `CreatedAt Time` Creation timestamp - `Items []WatchlistItemEntry` Items in the watchlist - `ID string` Item ID - `AddedAt Time` When the item was added - `AddedPrice string` Price when the item was added - `Instrument Instrument` Instrument details - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `OptionsExpiryDates []Time` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments - `Name string` Watchlist name ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.GetWatchlistByID(context.TODO(), "550e8400-e29b-41d4-a716-446655440000") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Watchlist.NewWatchlist(ctx, body) (*V1WatchlistNewWatchlistResponse, error)` **post** `/v1/watchlists` Create Watchlist ### Parameters - `body V1WatchlistNewWatchlistParams` - `Name param.Field[string]` The desired watchlist name. ### Returns - `type V1WatchlistNewWatchlistResponse struct{…}` - `Data WatchlistEntry` Represents a user watchlist. - `ID string` The unique identifier for the watchlist. - `CreatedAt Time` The timestamp when the watchlist was created. - `Name string` The user-provided watchlist name. ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.NewWatchlist(context.TODO(), clearstreet.V1WatchlistNewWatchlistParams{ Name: "name", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### 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 `client.V1.Watchlist.DeleteWatchlist(ctx, watchlistID) (*V1WatchlistDeleteWatchlistResponse, error)` **delete** `/v1/watchlists/{watchlist_id}` Delete a watchlist and all its items ### Parameters - `watchlistID string` ### Returns - `type V1WatchlistDeleteWatchlistResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.DeleteWatchlist(context.TODO(), "550e8400-e29b-41d4-a716-446655440000") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": null, "metadata": { "request_id": "cb824f1b-ea6e-4045-8169-9503be2b24d7" } } ``` ## Add Watchlist Item `client.V1.Watchlist.AddWatchlistItem(ctx, watchlistID, body) (*V1WatchlistAddWatchlistItemResponse, error)` **post** `/v1/watchlists/{watchlist_id}/items` Add an instrument to a watchlist ### Parameters - `watchlistID string` - `body V1WatchlistAddWatchlistItemParams` - `InstrumentID param.Field[InstrumentIDOrSymbol]` OEMS instrument UUID ### Returns - `type V1WatchlistAddWatchlistItemResponse struct{…}` - `Data AddWatchlistItemData` Response data for adding a watchlist item - `ItemID string` ID of the created item ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.AddWatchlistItem( context.TODO(), "550e8400-e29b-41d4-a716-446655440000", clearstreet.V1WatchlistAddWatchlistItemParams{ InstrumentID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": { "item_id": "770e8400-e29b-41d4-a716-446655440002" }, "error": null, "metadata": { "request_id": "b2c3d4e5-f6a7-8901-2345-678901bcdefg" } } ``` ## Delete Watchlist Item `client.V1.Watchlist.DeleteWatchlistItem(ctx, itemID, body) (*V1WatchlistDeleteWatchlistItemResponse, error)` **delete** `/v1/watchlists/{watchlist_id}/items/{item_id}` Delete an instrument from a watchlist ### Parameters - `itemID string` - `body V1WatchlistDeleteWatchlistItemParams` - `WatchlistID param.Field[string]` Watchlist ID ### Returns - `type V1WatchlistDeleteWatchlistItemResponse interface{…}` ### Example ```go package main import ( "context" "fmt" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.V1.Watchlist.DeleteWatchlistItem( context.TODO(), "660e8400-e29b-41d4-a716-446655440001", clearstreet.V1WatchlistDeleteWatchlistItemParams{ WatchlistID: "550e8400-e29b-41d4-a716-446655440000", }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response) } ``` #### Response ```json { "data": null, "metadata": { "request_id": "5b0709e3-5868-4116-9a84-26f1b8c30503" } } ``` ## Domain Types ### Add Watchlist Item Data - `type AddWatchlistItemData struct{…}` Response data for adding a watchlist item - `ItemID string` ID of the created item ### Watchlist Detail - `type WatchlistDetail struct{…}` Detailed watchlist with all items - `ID string` Watchlist ID - `CreatedAt Time` Creation timestamp - `Items []WatchlistItemEntry` Items in the watchlist - `ID string` Item ID - `AddedAt Time` When the item was added - `AddedPrice string` Price when the item was added - `Instrument Instrument` Instrument details - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `OptionsExpiryDates []Time` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments - `Name string` Watchlist name ### Watchlist Entry - `type WatchlistEntry struct{…}` Represents a user watchlist. - `ID string` The unique identifier for the watchlist. - `CreatedAt Time` The timestamp when the watchlist was created. - `Name string` The user-provided watchlist name. ### Watchlist Entry List - `type WatchlistEntryList []WatchlistEntry` - `ID string` The unique identifier for the watchlist. - `CreatedAt Time` The timestamp when the watchlist was created. - `Name string` The user-provided watchlist name. ### Watchlist Item Entry - `type WatchlistItemEntry struct{…}` A single item in a watchlist - `ID string` Item ID - `AddedAt Time` When the item was added - `AddedPrice string` Price when the item was added - `Instrument Instrument` Instrument details - `ID string` Unique OEMS instrument identifier (UUID) - `CountryOfIssue string` The ISO country code of the instrument's issue - `Currency string` The ISO currency code in which the instrument is traded - `EasyToBorrow bool` Indicates if the instrument is classified as Easy-To-Borrow - `IsLiquidationOnly bool` Indicates if the instrument is liquidation only and cannot be bought - `IsMarginable bool` Indicates if the instrument is marginable - `IsRestricted bool` Indicates if the instrument is restricted from trading - `IsShortProhibited bool` Indicates if short selling is prohibited for the instrument - `IsThresholdSecurity bool` Indicates if the instrument is on the Regulation SHO Threshold Security List - `IsTradable bool` Indicates if the instrument is tradable - `Symbol string` The trading symbol for the instrument - `Venue string` The MIC code of the primary listing venue - `Adv string` Average daily share volume from the security definition. - `Expiry Time` The expiration date for options instruments - `InstrumentType SecurityType` The type of security (e.g., Common Stock, ETF) - `const SecurityTypeCommonStock SecurityType = "COMMON_STOCK"` - `const SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"` - `const SecurityTypeOption SecurityType = "OPTION"` - `const SecurityTypeCash SecurityType = "CASH"` - `const SecurityTypeOther SecurityType = "OTHER"` - `LongMarginRate string` The percent of a long position's value you must post as margin - `Name string` The full name of the instrument or its issuer - `NotionalAdv string` 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. - `OptionsExpiryDates []Time` Available options expiration dates for this instrument. Present only when `include_options_expiry_dates=true` in the request. - `PreviousClose string` Last close price from the security definition. - `ShortMarginRate string` The percent of a short position's value you must post as margin - `StrikePrice string` The strike price for options instruments # Websocket ## Websocket Handler `client.V1.Websocket.WebsocketHandler(ctx) error` **get** `/v1/ws` Upgrade the HTTP connection to a WebSocket and echo incoming messages. ### Example ```go package main import ( "context" "github.com/clear-street/clear-street-go" "github.com/clear-street/clear-street-go/option" ) func main() { client := clearstreet.NewClient( option.WithAPIKey("My API Key"), ) err := client.V1.Websocket.WebsocketHandler(context.TODO()) if err != nil { panic(err.Error()) } } ```