• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Order Class Reference

The order's description. More...

Public Member Functions

override bool Equals (object p_other)
 
override int GetHashCode ()
 

Static Public Attributes

static int CUSTOMER = 0
 
static int FIRM = 1
 
static char OPT_UNKNOWN = '?'
 
static char OPT_BROKER_DEALER = 'b'
 
static char OPT_CUSTOMER = 'c'
 
static char OPT_FIRM = 'f'
 
static char OPT_ISEMM = 'm'
 
static char OPT_FARMM = 'n'
 
static char OPT_SPECIALIST = 'y'
 
static int AUCTION_MATCH = 1
 
static int AUCTION_IMPROVEMENT = 2
 
static int AUCTION_TRANSPARENT = 3
 
static string EMPTY_STR = ""
 
static double COMPETE_AGAINST_BEST_OFFSET_UP_TO_MID = double.PositiveInfinity
 

Properties

int OrderId [get, set]
 The API client's order id.
 
bool Solicited [get, set]
 The 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.
 
int ClientId [get, set]
 The API client id which placed the order.
 
int PermId [get, set]
 The Host order identifier.
 
string Action [get, set]
 Identifies the side.
Generally available values are BUY and SELL.
Additionally, SSHORT and SLONG are available in some institutional-accounts only.
For general account types, a SELL order will be able to enter a short position automatically if the order quantity is larger than your current long position.
SSHORT is only supported for institutional account configured with Long/Short account segments or clearing with a separate account.
SLONG is available in specially-configured institutional accounts to indicate that long position not yet delivered is being sold.
 
decimal TotalQuantity [get, set]
 The number of positions being bought/sold.
 
string OrderType [get, set]
 The order's type.
 
double LmtPrice [get, set]
 The LIMIT price.
Used for limit, stop-limit and relative orders. In all other cases specify zero. For relative orders with no limit price, also specify zero.
 
double AuxPrice [get, set]
 Generic field to contain the stop price for STP LMT orders, trailing amount, etc.
 
string Tif [get, set]
 The 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), exchange for shares, or distribution of shares. If you do not log into your IB account for 90 days.
At the end of the calendar quarter following the current quarter. For example, an order placed during the third quarter of 2011 will be canceled at the end of the first quarter of 2012. If the last day is a non-trading day, the cancellation will occur at the close of the final trading day of that quarter. For example, if the last day of the quarter is Sunday, the orders will be cancelled on the preceding Friday.
Orders that are modified will be assigned a new “Auto Expire” date consistent with the end of the calendar quarter following the current quarter.
Orders submitted to IB that remain in force for more than one day will not be reduced for dividends. To allow adjustment to your order price on ex-dividend date, consider using a Good-Til-Date/Time (GTD) or Good-after-Time/Date (GAT) order type, or a combination of the two.
IOC - Immediate or Cancel. Any portion that is not filled as soon as it becomes available in the market is canceled.
GTD - Good until Date. It will remain working within the system and in the marketplace until it executes or until the close of the market on the date specified
OPG - Use OPG to send a market-on-open (MOO) or limit-on-open (LOO) order.
FOK - If the entire Fill-or-Kill order does not execute as soon as it becomes available, the entire order is canceled.
DTC - Day until Canceled.
 
string OcaGroup [get, set]
 One-Cancels-All group identifier.
 
int OcaType [get, set]
 Tells 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.
 
string OrderRef [get, set]
 The order reference.
Intended for institutional customers only, although all customers may use it to identify the API client that sent the order when multiple API clients are running.
 
bool Transmit [get, set]
 Specifies whether the order will be transmitted by TWS. If set to false, the order will be created at TWS but will not be sent.
 
int ParentId [get, set]
 The order ID of the parent order, used for bracket and auto trailing stop orders.
 
bool BlockOrder [get, set]
 If set to true, specifies that the order is an ISE Block order.
 
bool SweepToFill [get, set]
 If set to true, specifies that the order is a Sweep-to-Fill order.
 
int DisplaySize [get, set]
 The publicly disclosed order size, used when placing Iceberg orders.
 
int TriggerMethod [get, set]
 Specifies how Simulated Stop, Stop-Limit and Trailing Stop orders are triggered.
Valid values are:
0 - The default value. The "double bid/ask" function will be used for orders for OTC stocks and US options. All other orders will used the "last" function.
1 - use "double bid/ask" function, where stop orders are triggered based on two consecutive bid or ask prices.
2 - "last" function, where stop orders are triggered based on the last price.
3 - double last function.
4 - bid/ask function.
7 - last or bid/ask function.
8 - mid-point function.
 
bool OutsideRth [get, set]
 If set to true, allows orders to also trigger or fill outside of regular trading hours.
 
bool Hidden [get, set]
 If 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.
 
string GoodAfterTime [get, set]
 Specifies the date and time after which the order will be active.
Format: yyyymmdd hh:mm:ss {optional Timezone}.
 
string GoodTillDate [get, set]
 The date and time until the order will be active.
You must enter GTD as the time in force to use this string. The trade's "Good Till Date," format "yyyyMMdd HH:mm:ss (optional time zone)" or UTC "yyyyMMdd-HH:mm:ss".
 
bool OverridePercentageConstraints [get, set]
 Overrides TWS constraints.
Precautionary constraints are defined on the TWS Presets page, and help ensure tha tyour price and size order values are reasonable. Orders sent from the API are also validated against these safety constraints, and may be rejected if any constraint is violated. To override validation, set this parameter’s value to True.
 
string Rule80A [get, set]
 Individual = 'I'
Agency = 'A'
AgentOtherMember = 'W'
IndividualPTIA = 'J'
AgencyPTIA = 'U'
AgentOtherMemberPTIA = 'M'
IndividualPT = 'K'
AgencyPT = 'Y'
AgentOtherMemberPT = 'N'.
 
bool AllOrNone [get, set]
 Indicates whether or not all the order has to be filled on a single execution.
 
int MinQty [get, set]
 Identifies a minimum quantity order type.
 
double PercentOffset [get, set]
 The percent offset amount for relative orders.
 
double TrailStopPrice [get, set]
 Trail stop price for TRAIL LIMIT orders.
 
double TrailingPercent [get, set]
 Specifies the trailing amount of a trailing stop order as a percentage.
Observe the following guidelines when using the trailingPercent field: More...
 
string FaGroup [get, set]
 The Financial Advisor group the trade will be allocated to. Use an empty string if not applicable.
 
string FaMethod [get, set]
 The Financial Advisor allocation method the trade will be allocated to. Use an empty string if not applicable.
 
string FaPercentage [get, set]
 The Financial Advisor percentage concerning the trade's allocation. Use an empty string if not applicable.
 
string OpenClose [get, set]
 For 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.
 
int Origin [get, set]
 The 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.
 
int ShortSaleSlot [get, set]
 For institutions only.
Valid values are:
1 - Broker holds shares
2 - Shares come from elsewhere.
 
string DesignatedLocation [get, set]
 
int ExemptCode [get, set]
 Only available with IB Execution-Only accounts with applicable securities.
Mark order as exempt from short sale uptick rule.
 
double DiscretionaryAmt [get, set]
 The amount off the limit price allowed for discretionary orders.
 
bool OptOutSmartRouting [get, set]
 Use 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, orders routed directly to ASX will NOT use SmartRouting.
When set to true, orders routed directly to ASX orders WILL use SmartRouting.
 
int AuctionStrategy [get, set]
 For BOX orders only.
Values include:
1 - Match
2 - Improvement
3 - Transparent.
 
double StartingPrice [get, set]
 The auction's starting price. For BOX orders only.
 
double StockRefPrice [get, set]
 The 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), and for price range monitoring.
 
double Delta [get, set]
 The stock's Delta. For orders on BOX only.
 
double StockRangeLower [get, set]
 The lower value for the acceptable underlying stock price range.
For price improvement option orders on BOX and VOL orders with dynamic management.
 
double StockRangeUpper [get, set]
 The upper value for the acceptable underlying stock price range.
For price improvement option orders on BOX and VOL orders with dynamic management.
 
double Volatility [get, set]
 The option price in volatility, as calculated by TWS' Option Analytics.
This value is expressed as a percent and is used to calculate the limit price sent to the exchange.
 
int VolatilityType [get, set]
 Values include:
1 - Daily Volatility
2 - Annual Volatility.
 
int ContinuousUpdate [get, set]
 Specifies whether TWS will automatically update the limit price of the order as the underlying price moves. VOL orders only.
 
int ReferencePriceType [get, set]
 Specifies how you want TWS to calculate the limit price for options, and for stock range price monitoring.
VOL orders only.
Valid values include:
1 - Average of NBBO
2 - NBB or the NBO depending on the action and right.
 
string DeltaNeutralOrderType [get, set]
 Enter 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, specify NONE.
 
double DeltaNeutralAuxPrice [get, set]
 Use this field to enter a value if the value in the deltaNeutralOrderType field is an order type that requires an Aux price, such as a REL order. VOL orders only.
 
int DeltaNeutralConId [get, set]
 The unique contract identifier specifying the security in Delta Neutral order.
 
string DeltaNeutralSettlingFirm [get, set]
 Indicates the firm which will settle the Delta Neutral trade. Institutions only.
 
string DeltaNeutralClearingAccount [get, set]
 Specifies the beneficiary of the Delta Neutral order.
 
string DeltaNeutralClearingIntent [get, set]
 Specifies where the clients want their shares to be cleared at. Must be specified by execution-only clients.
Valid values are:
IB, Away, and PTA (post trade allocation).
 
string DeltaNeutralOpenClose [get, set]
 Specifies 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.
 
bool DeltaNeutralShortSale [get, set]
 Used when the hedge involves a stock and indicates whether or not it is sold short.
 
int DeltaNeutralShortSaleSlot [get, set]
 Indicates 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, then you must specify a deltaNeutralDesignatedLocation.
 
string DeltaNeutralDesignatedLocation [get, set]
 Identifies third party order origin. Used only when deltaNeutralShortSaleSlot = 2.
 
double BasisPoints [get, set]
 Specifies Basis Points for EFP order. The values increment in 0.01% = 1 basis point. For EFP orders only.
 
int BasisPointsType [get, set]
 Specifies the increment of the Basis Points. For EFP orders only.
 
int ScaleInitLevelSize [get, set]
 Defines the size of the first, or initial, order component. For Scale orders only.
 
int ScaleSubsLevelSize [get, set]
 Defines the order size of the subsequent scale order components. For Scale orders only. Used in conjunction with scaleInitLevelSize().
 
double ScalePriceIncrement [get, set]
 Defines the price increment between scale components. For Scale orders only. This value is compulsory.
 
double ScalePriceAdjustValue [get, set]
 Modifies the value of the Scale order. For extended Scale orders.
 
int ScalePriceAdjustInterval [get, set]
 Specifies the interval when the price is adjusted. For extended Scale orders.
 
double ScaleProfitOffset [get, set]
 Specifies the offset when to adjust profit. For extended scale orders.
 
bool ScaleAutoReset [get, set]
 Restarts the Scale series if the order is cancelled. For extended scale orders.
 
int ScaleInitPosition [get, set]
 The initial position of the Scale order. For extended scale orders.
 
int ScaleInitFillQty [get, set]
 Specifies the initial quantity to be filled. For extended scale orders.
 
bool ScaleRandomPercent [get, set]
 Defines the random percent by which to adjust the position. For extended scale orders.
 
string HedgeType [get, set]
 For hedge orders.
Possible values include:
D - Delta
B - Beta
F - FX
P - Pair
 
string HedgeParam [get, set]
 For hedge orders.
Beta = x for Beta hedge orders, ratio = y for Pair hedge order
 
string Account [get, set]
 The account the trade will be allocated to.
 
string SettlingFirm [get, set]
 Indicates the firm which will settle the trade. Institutions only.
 
string ClearingAccount [get, set]
 Specifies the true beneficiary of the order.
For IBExecution customers. This value is required for FUT/FOP orders for reporting to the exchange.
 
string ClearingIntent [get, set]
 For execution-only clients to know where do they want their shares to be cleared at.
Valid values are:
IB, Away, and PTA (post trade allocation).
 
string AlgoStrategy [get, set]
 The algorithm strategy.
As of API verion 9.6, the following algorithms are supported:
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, refer to https://interactivebrokers.github.io/tws-api/ibalgos.html
 
List< TagValueAlgoParams [get, set]
 The list of parameters for the IB algorithm.
For more information about IB's API algorithms, refer to https://interactivebrokers.github.io/tws-api/ibalgos.html
 
bool WhatIf [get, set]
 Allows to retrieve the commissions and margin information.
When placing an order with this attribute set to true, the order will not be placed as such. Instead it will used to request the commissions and margin information that would result from this order.
 
string AlgoId [get, set]
 Identifies orders generated by algorithmic trading.
 
bool NotHeld [get, set]
 Orders routed to IBDARK are tagged as “post only” and are held in IB's order book, where incoming SmartRouted orders from other IB customers are eligible to trade against them.
For IBDARK orders only.
 
List< TagValueSmartComboRoutingParams [get, set]
 Advanced parameters for Smart combo routing.
These features are for both guaranteed and nonguaranteed combination orders routed to Smart, and are available based on combo type and order type. SmartComboRoutingParams is similar to AlgoParams in that it makes use of tag/value pairs to add parameters to combo orders.
Make sure that you fully understand how Advanced Combo Routing works in TWS itself first: https://www.interactivebrokers.com/en/software/tws/usersguidebook/specializedorderentry/advanced_combo_routing.htm
The parameters cover the following capabilities: More...
 
List< OrderComboLegOrderComboLegs [get, set]
 List of Per-leg price following the same sequence combo legs are added. The combo price must be left unspecified when using per-leg prices.
 
List< TagValueOrderMiscOptions = new List<OrderComboLeg>() [get, set]
 For internal use only. Use the default value XYZ.
 
string ActiveStartTime = new List<TagValue>() [get, set]
 Defines the start time of GTC orders.
 
string ActiveStopTime [get, set]
 Defines the stop time of GTC orders.
 
string ScaleTable [get, set]
 The list of scale orders. Used for scale orders.
 
string ModelCode [get, set]
 Is used to place an order to a model. For example, "Technology" model can be used for tech stocks first created in TWS.
 
string ExtOperator [get, set]
 This is a regulartory attribute that applies to all US Commodity (Futures) Exchanges, provided to allow client to comply with CFTC Tag 50 Rules.
 
double CashQty [get, set]
 The native cash quantity.
 
string Mifid2DecisionMaker [get, set]
 Identifies 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+.
 
string Mifid2DecisionAlgo [get, set]
 Identifies the algorithm responsible for investment decisions within the firm. Orders covered under MiFID 2 must include either Mifid2DecisionMaker or Mifid2DecisionAlgo, but cannot have both. Requires TWS 969+.
 
string Mifid2ExecutionTrader [get, set]
 For MiFID 2 reporting; identifies a person as the responsible party for the execution of a transaction within the firm. Requires TWS 969+.
 
string Mifid2ExecutionAlgo [get, set]
 For MiFID 2 reporting; identifies the algorithm responsible for the execution of a transaction within the firm. Requires TWS 969+.
 
bool DontUseAutoPriceForHedge [get, set]
 Don't use auto price for hedge.
 
string AutoCancelDate [get, set]
 Specifies the date to auto cancel the order.
 
decimal FilledQuantity [get, set]
 Specifies the initial order quantity to be filled.
 
int RefFuturesConId [get, set]
 Identifies the reference future conId.
 
bool AutoCancelParent [get, set]
 Cancels the parent order if child order was cancelled.
 
string Shareholder [get, set]
 Identifies the Shareholder.
 
bool ImbalanceOnly [get, set]
 Used to specify "imbalance only open orders" or "imbalance only closing orders".
 
bool RouteMarketableToBbo [get, set]
 Routes market order to Best Bid Offer.
 
long ParentPermId [get, set]
 Parent order Id.
 
string AdvancedErrorOverride [get, set]
 Accepts a list with parameters obtained from advancedOrderRejectJson.
 
string ManualOrderTime [get, set]
 Used by brokers and advisors when manually entering, modifying or cancelling orders at the direction of a client. Only used when allocating orders to specific groups or accounts. Excluding "All" group.
 
int MinTradeQty [get, set]
 Defines the minimum trade quantity to fill. For IBKRATS orders.
 
int MinCompeteSize [get, set]
 Defines the minimum size to compete. For IBKRATS orders.
 
double CompeteAgainstBestOffset [get, set]
 Dpecifies the offset Off The Midpoint that will be applied to the order. For IBKRATS orders.
 
double MidOffsetAtWhole [get, set]
 This 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.
 
double MidOffsetAtHalf [get, set]
 This offset is applied when the spread is an odd number of cents wide. This offset must be in half-penny increments. For IBKRATS orders.
 
bool RandomizeSize [get, set]
 Randomizes the order's size. Only for Volatility and Pegged to Volatility orders.
 
bool RandomizePrice [get, set]
 Randomizes the order's price. Only for Volatility and Pegged to Volatility orders.
 
int ReferenceContractId [get, set]
 Pegged-to-benchmark orders: this attribute will contain the conId of the contract against which the order will be pegged.
 
bool IsPeggedChangeAmountDecrease [get, set]
 Pegged-to-benchmark orders: indicates whether the order's pegged price should increase or decreases.
 
double PeggedChangeAmount [get, set]
 Pegged-to-benchmark orders: amount by which the order's pegged price should move.
 
double ReferenceChangeAmount [get, set]
 Pegged-to-benchmark orders: the amount the reference contract needs to move to adjust the pegged order.
 
string ReferenceExchange [get, set]
 Pegged-to-benchmark orders: the exchange against which we want to observe the reference contract.
 
string AdjustedOrderType [get, set]
 Adjusted Stop orders: the parent order will be adjusted to the given type when the adjusted trigger price is penetrated.
 
double TriggerPrice [get, set]
 Adjusted Stop orders: specifies the trigger price to execute.
 
double LmtPriceOffset [get, set]
 Adjusted Stop orders: specifies the price offset for the stop to move in increments.
 
double AdjustedStopPrice [get, set]
 Adjusted Stop orders: specifies the stop price of the adjusted (STP) parent.
 
double AdjustedStopLimitPrice [get, set]
 Adjusted Stop orders: specifies the stop limit price of the adjusted (STPL LMT) parent.
 
double AdjustedTrailingAmount [get, set]
 Adjusted Stop orders: specifies the trailing amount of the adjusted (TRAIL) parent.
 
int AdjustableTrailingUnit [get, set]
 Adjusted Stop orders: specifies where the trailing unit is an amount (set to 0) or a percentage (set to 1)
 
List< OrderCondition > Conditions [get, set]
 Conditions determining when the order will be activated or canceled.
 
bool ConditionsIgnoreRth [get, set]
 Indicates whether or not conditions will also be valid outside Regular Trading Hours.
 
bool ConditionsCancelOrder [get, set]
 Conditions can determine if an order should become active or canceled.
 
SoftDollarTier Tier [get, set]
 Define the Soft Dollar Tier used for the order. Only provided for registered professional advisors and hedge and mutual funds.
 
bool IsOmsContainer [get, set]
 Set to true to create tickets from API orders when TWS is used as an OMS.
 
bool DiscretionaryUpToLimitPrice [get, set]
 Set to true to convert order of type 'Primary Peg' to 'D-Peg'.
 
bool UsePriceMgmtAlgo [get, set]
 Specifies wether to use Price Management Algo. CTCI users only.
 
int Duration [get, set]
 Specifies the duration of the order. Format: yyyymmdd hh:mm:ss TZ. For GTD orders.
 
int PostToAts [get, set]
 Value must be positive, and it is number of seconds that SMART order would be parked for at IBKRATS before being routed to exchange.
 

Detailed Description

The order's description.

See Also
Contract, OrderComboLeg, OrderState

Property Documentation

string DesignatedLocation
getset

For 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).

List<TagValue> SmartComboRoutingParams
getset

Advanced parameters for Smart combo routing.
These features are for both guaranteed and nonguaranteed combination orders routed to Smart, and are available based on combo type and order type. SmartComboRoutingParams is similar to AlgoParams in that it makes use of tag/value pairs to add parameters to combo orders.
Make sure that you fully understand how Advanced Combo Routing works in TWS itself first: https://www.interactivebrokers.com/en/software/tws/usersguidebook/specializedorderentry/advanced_combo_routing.htm
The parameters cover the following capabilities:

  • Non-Guaranteed - Determine if the combo order is Guaranteed or Non-Guaranteed.
    Tag = NonGuaranteed
    Value = 0: The order is guaranteed
    Value = 1: The order is non-guaranteed

  • Select Leg to Fill First - User can specify which leg to be executed first.
    Tag = LeginPrio
    Value = -1: No priority is assigned to either combo leg
    Value = 0: Priority is assigned to the first leg being added to the comboLeg
    Value = 1: Priority is assigned to the second leg being added to the comboLeg
    Note: The LeginPrio parameter can only be applied to two-legged combo.

  • Maximum Leg-In Combo Size - Specify the maximum allowed leg-in size per segment
    Tag = MaxSegSize
    Value = Unit of combo size

  • Do Not Start Next Leg-In if Previous Leg-In Did Not Finish - Specify whether or not the system should attempt to fill the next segment before the current segment fills.
    Tag = DontLeginNext
    Value = 0: Start next leg-in even if previous leg-in did not finish
    Value = 1: Do not start next leg-in if previous leg-in did not finish

  • Price Condition - Combo order will be rejected or cancelled if the leg market price is outside of the specified price range [CondPriceMin, CondPriceMax]
    Tag = PriceCondConid: The ContractID of the combo leg to specify price condition on
    Value = The ContractID
    Tag = CondPriceMin: The lower price range of the price condition
    Value = The lower price
    Tag = CondPriceMax: The upper price range of the price condition
    Value = The upper price

double TrailingPercent
getset

Specifies the trailing amount of a trailing stop order as a percentage.
Observe the following guidelines when using the trailingPercent field:

  • 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.