Order

View as MarkdownOpen in Claude

Order

FieldTypeDescription
clientIdint32The API client id which placed the order.
orderIdint32The API client’s order id.
permIdint64The Host order identifier.
parentIdint32The order ID of the parent order, used for bracket and auto trailing stop orders.
actionstringIdentifies the side. Generally available values are BUY and SELL. Additionally, SSHORT and SLONG are available in some institutional-accounts only.
totalQuantitystringThe number of positions being bought/sold.
displaySizeint32The publicly disclosed order size
orderTypestringThe order’s type.
lmtPricedoubleThe LIMIT price. Used for limit
auxPricedoubleGeneric field to contain the stop price for STP LMT orders, trailing amount, etc.
tifstringThe time in force. Valid values are: DAY – Valid for the day only. GTC – Good until canceled. The order will continue to work within the system and in the marketplace until it executes or is canceled. GTC orders will be automatically be cancelled under the following conditions: If a corporate action on a security results in a stock split (forward or reverse)
accountstringThe IBKR account identifier to affiliate the request with
settlingFirmstringIndicates the firm which will settle the trade. Institutions only.
clearingAccountstringSpecifies the true beneficiary of the order. For IBExecution customers. This value is required for FUT/FOP orders for reporting to the exchange.
clearingIntentstringFor execution-only clients to know where do they want their shares to be cleared at. Valid values are: IB
allOrNoneboolIndicates whether or not all the order has to be filled on a single execution.
blockOrderboolIf set to true
hiddenboolIf set to true, the order will not be visible when viewing the market depth. This option only applies to orders routed to the NASDAQ exchange.
outsideRthboolIf set to true, allows orders to also trigger or fill outside of regular trading hours.
sweepToFillboolIf set to true
percentOffsetdoubleThe percent offset amount for relative orders.
trailingPercentdoubleSpecifies the trailing amount of a trailing stop order as a percentage. Observe the following guidelines when using the trailingPercent field: Guidelines * This field is mutually exclusive with the existing trailing amount. That is, the API client can send one or the other but not both. * This field is read AFTER the stop price (barrier price) as follows: deltaNeutralAuxPrice stopPrice, trailingPercent, scale order attributes. * The field will also be sent to the API in the openOrder message if the API client version is >= 56. It is sent after the stopPrice field as follows: stopPrice, trailingPct, basisPoint.
trailStopPricedoubleTrail stop price for TRAIL LIMIT orders.
minQtyint32Identifies a minimum quantity order type.
goodAfterTimestringSpecifies the date and time after which the order will be active. Format: yyyymmdd hh:mm:ss {optional Timezone}.
goodTillDatestringThe date and time when the order should cancel if not already filled. Only valid for orders using the “GTD” tif. Users that would prefer to specify a number of seconds should use the Duration parameter instead. Both values cannot be specified at the same time.
ocaGroupstringOne-Cancels-All group identifier.
orderRefstringThe order reference. Intended for institutional customers only
rule80AstringIndividual = ‘I’ Agency = ‘A’ AgentOtherMember = ‘W’ IndividualPTIA = ‘J’ AgencyPTIA = ‘U’ AgentOtherMemberPTIA = ‘M’ IndividualPT = ‘K’ AgencyPT = ‘Y’ AgentOtherMemberPT = ‘N’.
ocaTypeint32Tells how to handle remaining orders in an OCA group when one order or part of an order executes. Valid values are: 1 – Cancel all remaining orders with block. 2 – Remaining orders are proportionately reduced in size with block. 3 – Remaining orders are proportionately reduced in size with no block. If you use a value “with block” it gives the order overfill protection. This means that only one order in the group will be routed at a time to remove the possibility of an overfill.
triggerMethodint32Specifies how Simulated Stop
activeStartTimestringDefines the start time of GTC orders.
activeStopTimestringDefines the stop time of GTC orders.
faGroupstringThe Financial Advisor group the trade will be allocated to. Use an empty string if not applicable.
faMethodstringThe Financial Advisor allocation method the trade will be allocated to. Use an empty string if not applicable.
faPercentagestringThe Financial Advisor percentage concerning the trade’s allocation. Use an empty string if not applicable.
volatilitydoubleThe option price in volatility
volatilityTypeint32Values include: 1 – Daily Volatility 2 – Annual Volatility.
continuousUpdateboolSpecifies whether TWS will automatically update the limit price of the order as the underlying price moves. VOL orders only.
referencePriceTypeint32Specifies how you want TWS to calculate the limit price for options
deltaNeutralOrderTypestringEnter an order type to instruct TWS to submit a delta neutral trade on full or partial execution of the VOL order. VOL orders only. For no hedge delta order to be sent
deltaNeutralAuxPricedoubleUse this field to enter a value if the value in the deltaNeutralOrderType field is an order type that requires an Aux price
deltaNeutralConIdint32The unique contract identifier specifying the security in Delta Neutral order.
deltaNeutralOpenClosestringSpecifies whether the order is an Open or a Close order and is used when the hedge involves a CFD and and the order is clearing away.
deltaNeutralShortSaleboolUsed when the hedge involves a stock and indicates whether or not it is sold short.
deltaNeutralShortSaleSlotint32Indicates a short sale Delta Neutral order. Has a value of 1 (the clearing broker holds shares) or 2 (delivered from a third party). If you use 2
deltaNeutralDesignatedLocationstringIdentifies third party order origin. Used only when deltaNeutralShortSaleSlot = 2.
scaleInitLevelSizeint32Defines the size of the first
scaleSubsLevelSizeint32Defines the order size of the subsequent scale order components. For Scale orders only. Used in conjunction with scaleInitLevelSize().
scalePriceIncrementdoubleDefines the price increment between scale components. For Scale orders only. This value is compulsory.
scalePriceAdjustValuedoubleModifies the value of the Scale order. For extended Scale orders.
scalePriceAdjustIntervalint32Specifies the interval when the price is adjusted. For extended Scale orders.
scaleProfitOffsetdoubleSpecifies the offset when to adjust profit. For extended scale orders.
scaleAutoResetboolRestarts the Scale series if the order is cancelled. For extended scale orders.
scaleInitPositionint32The initial position of the Scale order. For extended scale orders.
scaleInitFillQtyint32Specifies the initial quantity to be filled. For extended scale orders.
scaleRandomPercentboolDefines the random percent by which to adjust the position. For extended scale orders.
scaleTablestringThe list of scale orders. Used for scale orders.
hedgeTypestringFor hedge orders. Possible values include: D – Delta B – Beta F – FX P – Pair
hedgeParamstringFor hedge orders. Beta = x for Beta hedge orders
algoStrategystringThe algorithm strategy. ArrivalPx – Arrival Price DarkIce – Dark Ice PctVol – Percentage of Volume Twap – TWAP (Time Weighted Average Price) Vwap – VWAP (Volume Weighted Average Price) For more information about IB’s API algorithms
algoParamsAlgoParamsEntryThe list of parameters for the IB algorithm. For more information about IB’s API algorithms
algoIdstringIdentifies orders generated by algorithmic trading.
smartComboRoutingParamsSmartComboRoutingParamsEntry
whatIfboolAllows to retrieve the commissions and margin information. When placing an order with this attribute set to true
transmitboolSpecifies whether the order will be transmitted by TWS. If set to false, the order will be created at TWS but will not be sent. Users implementing directly from Protobuf should be aware that Transmit should be implicitly set to ‘true’ when placing orders to transmit an order.
overridePercentageConstraintsboolOverrides TWS constraints. Precautionary constraints are defined on the TWS Presets page
openClosestringFor institutional customers only. Valid values are O (open) and C (close). Available for institutional clients to determine if this order is to open or close a position. When Action = “BUY” and OpenClose = “O” this will open a new position. When Action = “BUY” and OpenClose = “C” this will close and existing short position.
originint32The order’s origin. Same as TWS “Origin” column. Identifies the type of customer from which the order originated. Valid values are:0 – Customer 1 – Firm.
shortSaleSlotint32For institutions only. Valid values are: 1 – Broker holds shares 2 – Shares come from elsewhere.
designatedLocationstringFor institutions only. Indicates the location where the shares to short come from. Used only when short sale slot is set to 2 (which means that the shares to short are held elsewhere and not with IB).
exemptCodeint32Only available with IB Execution-Only accounts with applicable securities. Mark order as exempt from short sale uptick rule.
deltaNeutralSettlingFirmstringIndicates the firm which will settle the Delta Neutral trade. Institutions only.
deltaNeutralClearingAccountstringSpecifies the beneficiary of the Delta Neutral order.
deltaNeutralClearingIntentstringSpecifies where the clients want their shares to be cleared at. Must be specified by execution-only clients. Valid values are: IB
discretionaryAmtdoubleThe amount off the limit price allowed for discretionary orders.
optOutSmartRoutingboolUse to opt out of default SmartRouting for orders routed directly to ASX. This attribute defaults to false unless explicitly set to true. When set to false
startingPricedoubleThe auction’s starting price. For BOX orders only.
stockRefPricedoubleThe stock’s reference price. The reference price is used for VOL orders to compute the limit price sent to an exchange (whether or not Continuous Update is selected)
deltadoubleThe stock’s Delta. For orders on BOX only.
stockRangeLowerdoubleThe lower value for the acceptable underlying stock price range. For price improvement option orders on BOX and VOL orders with dynamic management.
stockRangeUpperdoubleThe upper value for the acceptable underlying stock price range. For price improvement option orders on BOX and VOL orders with dynamic management.
notHeldboolOrders routed to IBDARK are tagged as “post only” and are held in IB’s order book
orderMiscOptionsOrderMiscOptionsEntryFor internal use only. Use the default value XYZ.
solicitedboolThe Solicited field should be used for orders initiated or recommended by the broker or adviser that were approved by the client (by phone, email, chat, verbally, etc.) prior to entry. Please note that orders that the adviser or broker placed without specifically discussing with the client are discretionary orders, not solicited.
randomizeSizeboolRandomizes the order’s size. Only for Volatility and Pegged to Volatility orders.
randomizePriceboolRandomizes the order’s price. Only for Volatility and Pegged to Volatility orders.
referenceContractIdint32Pegged-to-benchmark orders: this attribute will contain the conId of the contract against which the order will be pegged.
peggedChangeAmountdoublePegged-to-benchmark orders: amount by which the order’s pegged price should move.
isPeggedChangeAmountDecreaseboolPegged-to-benchmark orders: indicates whether the order’s pegged price should increase or decreases.
referenceChangeAmountdoublePegged-to-benchmark orders: the amount the reference contract needs to move to adjust the pegged order.
referenceExchangeIdstring
adjustedOrderTypestringAdjusted Stop orders: the parent order will be adjusted to the given type when the adjusted trigger price is penetrated.
triggerPricedoubleAdjusted Stop orders: specifies the trigger price to execute.
adjustedStopPricedoubleAdjusted Stop orders: specifies the stop price of the adjusted (STP) parent.
adjustedStopLimitPricedoubleAdjusted Stop orders: specifies the stop limit price of the adjusted (STPL LMT) parent.
adjustedTrailingAmountdoubleAdjusted Stop orders: specifies the trailing amount of the adjusted (TRAIL) parent.
adjustableTrailingUnitint32Adjusted Stop orders: specifies where the trailing unit is an amount (set to 0) or a percentage (set to 1)
lmtPriceOffsetdoubleAdjusted Stop orders: specifies the price offset for the stop to move in increments.
conditionsOrderConditionConditions determining when the order will be activated or canceled.
conditionsCancelOrderboolConditions can determine if an order should become active or canceled.
conditionsIgnoreRthboolIndicates whether or not conditions will also be valid outside Regular Trading Hours.
modelCodestringIs used to place an order to a model. For example
extOperatorstringFollowing CME Rule 576, the ExtOperator field will signify if the unique API operator at the time of trading for order management.
softDollarTierSoftDollarTier
cashQtydoubleThe native cash quantity.
mifid2DecisionMakerstringIdentifies a person as the responsible party for investment decisions within the firm. Orders covered by MiFID 2 (Markets in Financial Instruments Directive 2) must include either Mifid2DecisionMaker or Mifid2DecisionAlgo field (but not both). Requires TWS 969+.
mifid2DecisionAlgostringIdentifies the algorithm responsible for investment decisions within the firm. Orders covered under MiFID 2 must include either Mifid2DecisionMaker or Mifid2DecisionAlgo
mifid2ExecutionTraderstringFor MiFID 2 reporting; identifies a person as the responsible party for the execution of a transaction within the firm. Requires TWS 969+.
mifid2ExecutionAlgostringFor MiFID 2 reporting; identifies the algorithm responsible for the execution of a transaction within the firm. Requires TWS 969+.
dontUseAutoPriceForHedgeboolDon’t use auto price for hedge.
isOmsContainerboolSet to true to create tickets from API orders when TWS is used as an OMS.
discretionaryUpToLimitPriceboolSet to true to convert order of type ‘Primary Peg’ to ‘D-Peg’.
autoCancelDatestringSpecifies the date to auto cancel the order.
filledQuantitystringSpecifies the initial order quantity to be filled.
refFuturesConIdint32Identifies the reference future conId.
autoCancelParentboolCancels the parent order if child order was cancelled.
shareholderstringIdentifies the Shareholder.
imbalanceOnlyboolUsed to specify “imbalance only open orders” or “imbalance only closing orders”.
routeMarketableToBboint32Routes market order to Best Bid Offer.
parentPermIdint64Parent order Id.
usePriceMgmtAlgoint32Specifies wether to use Price Management Algo. CTCI users only.
durationint32Specifies the number of seconds the order should remain active. For GTD orders only. Users that would prefer to specify an exact date should user the “GoodTillDate” parameter instead. Both values cannot be specified at the same time.
postToAtsint32Value must be positive
advancedErrorOverridestringAccepts a string with parameters obtained from advancedOrderRejectJson.
manualOrderTimestringUsed by brokers and advisors when manually entering an order request. Format should be “YYYYMMDD-HH:mm:ss” using UTC as the timezone value.
minTradeQtyint32Defines the minimum trade quantity to fill. For IBKRATS orders.
minCompeteSizeint32Defines the minimum size to compete. For IBKRATS orders.
competeAgainstBestOffsetdoubleDpecifies the offset Off The Midpoint that will be applied to the order. For IBKRATS orders.
midOffsetAtWholedoubleThis offset is applied when the spread is an even number of cents wide. This offset must be in whole-penny increments or zero. For IBKRATS orders.
midOffsetAtHalfdoubleThis offset is applied when the spread is an odd number of cents wide. This offset must be in half-penny increments. For IBKRATS orders.
customerAccountstringRequired for Nondisclosed Omnibus Accounts. A unique identifier for each account within the Omnibus structure to signify the account holder being traded. Best practice (Not Required): clients should look to hash this value, using something along the lines of 5 digits of SHA1 of the account number. This should not be implemented for non-omnibus accounts.
professionalCustomerbool
bondAccruedIntereststring
includeOvernightboolSpecify if the order should include overnight trading or not. False (no Overnight) is set by default.
manualOrderIndicatorint32Following CME Rule 576, the ManualOrderIndicator field will signify if an order is manual (1) or automated (0).
submitterstring
deactivateboolDetermines if the order is Active (False) or Deactivated (True). Orders that are deactivated are not submitted and will not execute, though they can be reviewed and transmitted via API, Trader Workstation, or Client Portal. This is unique from the Transmit field as orders submitted as Transmit=False will not leave the current TWS instance, and will be erased upon logout. Deactivated orders will persist internally at Interactive Brokers.
postOnlybool
allowPreOpenbool
ignoreOpenAuctionbool
seekPriceImprovementint32
whatIfTypeint32
hedgeMaxSizeint32hedgeMaxSize (also referred to as “Max Hedging Size”) is a user-supplied parameter that caps the maximum number of shares that can be shorted in a beta hedge child order. It provides an upper bound for risk and credit assessment purposes. Applied only to beta hedge orders (sell side only) for stocks in IB- cleared accounts.

Order.AlgoParamsEntry

FieldTypeDescription
keystring
valuestring

Order.OrderMiscOptionsEntry

FieldTypeDescription
keystring
valuestring

Order.SmartComboRoutingParamsEntry

FieldTypeDescription
keystring
valuestring