Build with the AI Skill
Trade ItTrade ItDocs
Data Models

Trade

An order and its fills. Get trades and the trade operations return trades, and TRADE_UPDATED webhook events send one as data.

Failure codes

When status is failed, use error_code to decide how to handle the failure and error_message for any available detail. A missing or null error_code means Trade It could not identify the cause: review error_message and check get trades with refresh: true before retrying.

CodeHandling
insufficient_buying_powerThe account cannot fund the order. Confirm sufficient buying power before retrying.
market_closedThe market or trading session is closed for this order. Wait for an eligible session.
invalid_orderOrder validation failed, for example because of the price, quantity, or order type. Correct the order before resubmitting.
not_tradableA restriction on the asset prevented the trade, such as a halted symbol or an option contract that no longer trades. Do not retry automatically.
account_action_requiredThe brokerage needs the user to act on their account first, such as accepting an agreement or risk disclosure, raising their options approval level, or using a margin account. Do not retry until the user confirms it is done.
brokerage_rate_limitedThe brokerage throttled the request. Back off before retrying.
brokerage_unavailableThe brokerage request timed out or encountered a service error. The order may still have reached the brokerage, so check get_trades with refresh: true before retrying.
needs_relinkThe user must reconnect the brokerage before trading.

Fields

idnumber | string

Trade It trade ID. Pass it as trade_id to execute or cancel the trade.

created_atstring

When the record was created.

updated_atstringoptional

When the record last changed.

user_idnumber | string

The Trade It user who owns the trade.

asset_idnumber | string

The traded asset, or the underlying for options.

account_idnumber | string | null

The account the trade is sent to.

parent_idnumber | string | null

The trade this take-profit or stop-loss exit belongs to, for certain bracket orders. Null otherwise.

error_codeenum | nulloptional

Machine-readable failure reason. Absent or null when Trade It could not identify the cause.

insufficient_buying_powermarket_closedinvalid_ordernot_tradableaccount_action_requiredbrokerage_rate_limitedbrokerage_unavailableneeds_relink
sourcestring | null

Where the trade came from: ios_app, chatgpt, mcp, api, or discord, or brokerage:<brokerage id> for trades synced from brokerage history.

image_urlstring | null

Screenshot the trade was created from.

external_idstring

The brokerage's order ID. Not included in webhook events.

external_group_idstring | nulloptional

The brokerage's ID for OCO group the order belongs to. Not included in webhook events.

typeenum

0 for a simple buy/sell, 1 for options/multi-leg.

01
actionenum

Whether the trade buys or sells.

buysell
directionenum | null

Whether a multi-leg trade pays (debit) or receives (credit) its net premium. Null for simple trades.

debitcrediteven
total_unitsnumber

Shares, coins, or futures contracts ordered. A multi-leg trade counts its whole package as 1.

filled_unitsnumber

Units filled so far.

canceled_unitsnumber

Units canceled. A canceled order can still be partly filled.

notional_amountBalance | null

Dollar amount, for orders placed by value instead of units.

execution_priceBalance | null

Average fill price, always positive. For multi-leg trades, the net cash for the whole package. Null until something fills.

statusenum

Order status. complete, canceled, failed, and disconnected are final.

draftpendingplacedpartially_filledcompletecanceledfaileddisconnected
order_typeenum

How the order is priced.

marketlimitstopstop_limit
limit_priceBalance | null

Limit price, for limit and stop-limit orders. For multi-leg trades, the net premium per spread unit.

stop_priceBalance | null

Price that triggers a stop or stop-limit order.

take_profitobject | nulloptional

Take-profit exit attached to a buy or OCO sell order.

valuenumber

Exit trigger level

unitenum

Absolute price ($) or percent from entry price (%).

$%
stop_lossobject | nulloptional

Stop-loss exit attached to a buy or OCO sell order.

valuenumber

Exit trigger level

unitenum

Absolute price ($) or percent from entry price (%).

$%
time_in_forceenum | null

How long the order stays active.

daygtciocfok
trading_sessionenum | nulloptional

Execution window selected for the order, when known.

regularpremarketafter_hoursextendedovernight24_524_7
placed_atstring (format: date-time) | null

When the order was sent to the brokerage.

executed_atstring (format: date-time) | null

When the order finished filling.

error_messagestring | null

Human-readable failure or order warning, when available.

feeBalance | null

Fees the brokerage charged.

legsarray of object | null

Legs of a multi-leg trade. Null for simple trades.

Each item has:

typeenum

Whether the leg trades an equity option, the underlying stock, or an option on a futures contract.

optionequityfuture_option
actionenum

Whether the leg buys or sells.

buysell
position_effectenum | null

Whether the leg opens or closes a position.

openclose
occstring | null

OCC option contract symbol, e.g. 260717C00435000. Null for stock and futures-option legs.

symbolstring

What the leg trades: the ticker for a stock leg, e.g. AAPL; the ticker followed by the OCC symbol for an option leg, e.g. AAPL260717C00435000; or the futures option symbol for a futures-option leg, e.g. ./ESZ26 EW3X26 261120C6000 (underlying contract, option series, expiration, call or put, strike).

quantitynumber

Number of option contracts, or shares for a stock leg.

execution_priceBalance | null

The leg's fill price per share. Null when the brokerage only reports a price for the whole package.

contractstring | nulloptional

Futures contract month code, e.g. Z26. Null for everything but futures.

eventenum | null

Set when the trade records an option assignment, exercise, or expiration instead of an order.

assignmentexerciseexpiration
analysisstring | null

Analysis of the screenshot the trade was created from.

assetobjectoptional

The traded asset. Expanded in get_trades responses and TRADE_UPDATED webhooks.

idnumber | string

The database ID. Use for lookups.

created_atstring

When the record was created.

updated_atstringoptional

When the record last changed.

namestring | null

Company or coin name.

tickerstring

Ticker symbol.

typeenum

Asset type: 2 for stocks, 4 for crypto, 8 for indexes, 16 for futures.

024816
logo_urlstring | null

Logo image URL.

descriptionstring | null

Short description of the asset.

exchangestring

Exchange the asset trades on.

mic_codestring | null

ISO 10383 market identifier code of the exchange.

underlyingstring | null

Underlying ticker, for derivatives.

countrystring | null

Country the asset is listed in.

futures_detailsobject | null

Root-level futures specifications. Null for non-futures assets or unknown products. Contract-specific dates, quotes, and account margin are separate.

multipliernumber

Futures monetary value of a 1.00 move in the quoted price, per contract, in quote_currency. Quoted price × multiplier × contracts gives notional exposure.

tick_sizenumber

Default outright futures price increment, in quoted price units. tick_size × multiplier gives the monetary tick value per contract.

quote_currencystring

ISO 4217 currency of futures monetary values after applying multiplier, e.g. USD.

contract_monthsstring

Listed futures delivery month codes in calendar order, e.g. HMUZ for March, June, September, December.

delisted_atstring (format: date-time) | null

When the asset was delisted.

Balance

Money fields are Balance objects.

amountnumber

Amount in currency.

currencystring

ISO 4217 currency code, such as USD.

On this page