pub struct Order {Show 142 fields
pub order_id: i32,
pub solicited: bool,
pub client_id: i32,
pub perm_id: i32,
pub action: Action,
pub total_quantity: f64,
pub order_type: String,
pub limit_price: Option<f64>,
pub aux_price: Option<f64>,
pub tif: TimeInForce,
pub oca_group: String,
pub oca_type: OcaType,
pub order_ref: String,
pub transmit: bool,
pub parent_id: i32,
pub block_order: bool,
pub sweep_to_fill: bool,
pub display_size: Option<i32>,
pub trigger_method: TriggerMethod,
pub outside_rth: bool,
pub hidden: bool,
pub good_after_time: String,
pub good_till_date: String,
pub override_percentage_constraints: bool,
pub rule_80_a: Option<Rule80A>,
pub all_or_none: bool,
pub min_qty: Option<i32>,
pub percent_offset: Option<f64>,
pub trail_stop_price: Option<f64>,
pub trailing_percent: Option<f64>,
pub fa_group: String,
pub fa_profile: String,
pub fa_method: String,
pub fa_percentage: String,
pub open_close: Option<OrderOpenClose>,
pub origin: OrderOrigin,
pub short_sale_slot: ShortSaleSlot,
pub designated_location: String,
pub exempt_code: i32,
pub discretionary_amt: f64,
pub opt_out_smart_routing: bool,
pub auction_strategy: Option<AuctionStrategy>,
pub starting_price: Option<f64>,
pub stock_ref_price: Option<f64>,
pub delta: Option<f64>,
pub stock_range_lower: Option<f64>,
pub stock_range_upper: Option<f64>,
pub volatility: Option<f64>,
pub volatility_type: Option<VolatilityType>,
pub continuous_update: bool,
pub reference_price_type: Option<ReferencePriceType>,
pub delta_neutral_order_type: String,
pub delta_neutral_aux_price: Option<f64>,
pub delta_neutral_con_id: i32,
pub delta_neutral_settling_firm: String,
pub delta_neutral_clearing_account: String,
pub delta_neutral_clearing_intent: String,
pub delta_neutral_open_close: String,
pub delta_neutral_short_sale: bool,
pub delta_neutral_short_sale_slot: i32,
pub delta_neutral_designated_location: String,
pub basis_points: Option<f64>,
pub basis_points_type: Option<i32>,
pub scale_init_level_size: Option<i32>,
pub scale_subs_level_size: Option<i32>,
pub scale_price_increment: Option<f64>,
pub scale_price_adjust_value: Option<f64>,
pub scale_price_adjust_interval: Option<i32>,
pub scale_profit_offset: Option<f64>,
pub scale_auto_reset: bool,
pub scale_init_position: Option<i32>,
pub scale_init_fill_qty: Option<i32>,
pub scale_random_percent: bool,
pub hedge_type: String,
pub hedge_param: String,
pub account: String,
pub settling_firm: String,
pub clearing_account: String,
pub clearing_intent: String,
pub algo_strategy: String,
pub algo_params: Vec<TagValue>,
pub what_if: bool,
pub algo_id: String,
pub not_held: bool,
pub smart_combo_routing_params: Vec<TagValue>,
pub order_combo_legs: Vec<OrderComboLeg>,
pub order_misc_options: Vec<TagValue>,
pub active_start_time: String,
pub active_stop_time: String,
pub scale_table: String,
pub model_code: String,
pub ext_operator: String,
pub cash_qty: Option<f64>,
pub mifid2_decision_maker: String,
pub mifid2_decision_algo: String,
pub mifid2_execution_trader: String,
pub mifid2_execution_algo: String,
pub dont_use_auto_price_for_hedge: bool,
pub auto_cancel_date: String,
pub filled_quantity: f64,
pub ref_futures_con_id: Option<i32>,
pub auto_cancel_parent: bool,
pub shareholder: String,
pub imbalance_only: bool,
pub route_marketable_to_bbo: bool,
pub parent_perm_id: Option<i64>,
pub advanced_error_override: String,
pub manual_order_time: String,
pub min_trade_qty: Option<i32>,
pub min_compete_size: Option<i32>,
pub compete_against_best_offset: Option<f64>,
pub mid_offset_at_whole: Option<f64>,
pub mid_offset_at_half: Option<f64>,
pub randomize_size: bool,
pub randomize_price: bool,
pub reference_contract_id: i32,
pub is_pegged_change_amount_decrease: bool,
pub pegged_change_amount: Option<f64>,
pub reference_change_amount: Option<f64>,
pub reference_exchange: String,
pub adjusted_order_type: String,
pub trigger_price: Option<f64>,
pub limit_price_offset: Option<f64>,
pub adjusted_stop_price: Option<f64>,
pub adjusted_stop_limit_price: Option<f64>,
pub adjusted_trailing_amount: Option<f64>,
pub adjustable_trailing_unit: i32,
pub conditions: Vec<OrderCondition>,
pub conditions_ignore_rth: bool,
pub conditions_cancel_order: bool,
pub soft_dollar_tier: SoftDollarTier,
pub is_oms_container: bool,
pub discretionary_up_to_limit_price: bool,
pub use_price_mgmt_algo: bool,
pub duration: Option<i32>,
pub post_to_ats: Option<i32>,
pub customer_account: String,
pub professional_customer: bool,
pub bond_accrued_interest: String,
pub include_overnight: bool,
pub manual_order_indicator: Option<i32>,
pub submitter: String,
}Expand description
Order describes the order.
Fields§
§order_id: i32The API client’s order id.
solicited: boolThe 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.
client_id: i32The API client id which placed the order.
perm_id: i32The Host order identifier.
action: ActionIdentifies 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.
total_quantity: f64The number of positions being bought/sold.
order_type: StringThe order’s type.
limit_price: Option<f64>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.
aux_price: Option<f64>Generic field to contain the stop price for STP LMT orders, trailing amount, etc.
tif: TimeInForceThe time in force - specifies how long the order remains active.
See TimeInForce for available options and their behavior.
oca_group: StringOne-Cancels-All group identifier.
oca_type: OcaTypeTells how to handle remaining orders in an OCA group when one order or part of an order executes.
See OcaType for available options. “With block” provides overfill protection by ensuring
only one order in the group is routed at a time.
order_ref: StringThe 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.
transmit: boolSpecifies whether the order will be transmitted by TWS. If set to false, the order will be created at TWS but will not be sent.
parent_id: i32The order ID of the parent order, used for bracket and auto trailing stop orders.
block_order: boolIf set to true, specifies that the order is an ISE Block order.
sweep_to_fill: boolIf set to true, specifies that the order is a Sweep-to-Fill order.
display_size: Option<i32>The publicly disclosed order size, used when placing Iceberg orders.
trigger_method: TriggerMethodSpecifies how Simulated Stop, Stop-Limit and Trailing Stop orders are triggered.
See conditions::TriggerMethod for available options.
outside_rth: boolIf set to true, allows orders to also trigger or fill outside of regular trading hours.
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.
good_after_time: StringSpecifies the date and time after which the order will be active. Format: yyyymmdd hh:mm:ss {optional Timezone}.
good_till_date: StringThe 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”.
override_percentage_constraints: boolOverrides TWS constraints. Precautionary constraints are defined on the TWS Presets page, and help ensure that your 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.
rule_80_a: Option<Rule80A>NYSE Rule 80A designation values:
- Individual =
I - Agency =
A - AgentOtherMember =
W - IndividualPTIA =
J - AgencyPTIA =
U - AgentOtherMemberPTIA =
M - IndividualPT =
K - AgencyPT =
Y - AgentOtherMemberPT =
N
all_or_none: boolIndicates whether or not all the order has to be filled on a single execution.
min_qty: Option<i32>Identifies a minimum quantity order type.
percent_offset: Option<f64>The percent offset amount for relative orders.
trail_stop_price: Option<f64>Trail stop price for TRAIL LIMIT orders.
trailing_percent: Option<f64>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.
fa_group: StringThe Financial Advisor group the trade will be allocated to. Use an empty string if not applicable.
fa_profile: StringThe Financial Advisor allocation profile the trade will be allocated to. Use an empty string if not applicable.
fa_method: StringThe Financial Advisor allocation method the trade will be allocated to. Use an empty string if not applicable.
fa_percentage: StringThe Financial Advisor percentage concerning the trade’s allocation. Use an empty string if not applicable.
open_close: Option<OrderOpenClose>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 an existing short position.
origin: OrderOriginThe order’s origin. Same as TWS “Origin” column. Identifies the type of customer from which the order originated.
See OrderOrigin for available options.
short_sale_slot: ShortSaleSlotFor institutions only. Specifies the short sale slot.
See ShortSaleSlot for available options.
designated_location: StringFor institutions only. Indicates the location where the shares to short come from.
Used only when short sale slot is set to ThirdParty.
exempt_code: i32Only available with IB Execution-Only accounts with applicable securities. Mark order as exempt from short sale uptick rule.
discretionary_amt: f64The amount off the limit price allowed for discretionary orders.
opt_out_smart_routing: boolUse 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.
auction_strategy: Option<AuctionStrategy>For BOX orders only.
See AuctionStrategy for available options.
starting_price: Option<f64>The auction’s starting price. For BOX orders only.
stock_ref_price: Option<f64>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.
delta: Option<f64>The stock’s Delta. For orders on BOX only.
stock_range_lower: Option<f64>The lower value for the acceptable underlying stock price range. For price improvement option orders on BOX and VOL orders with dynamic management.
stock_range_upper: Option<f64>The upper value for the acceptable underlying stock price range. For price improvement option orders on BOX and VOL orders with dynamic management.
volatility: Option<f64>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.
volatility_type: Option<VolatilityType>VOL orders only. See VolatilityType for available options.
continuous_update: boolSpecifies whether TWS will automatically update the limit price of the order as the underlying price moves. VOL orders only.
reference_price_type: Option<ReferencePriceType>Specifies how you want TWS to calculate the limit price for options, and for stock range price monitoring. VOL orders only.
See ReferencePriceType for available options.
delta_neutral_order_type: StringEnter 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.
delta_neutral_aux_price: Option<f64>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.
delta_neutral_con_id: i32The unique contract identifier specifying the security in Delta Neutral order.
delta_neutral_settling_firm: StringIndicates the firm which will settle the Delta Neutral trade. Institutions only.
delta_neutral_clearing_account: StringSpecifies the beneficiary of the Delta Neutral order.
delta_neutral_clearing_intent: StringSpecifies where the clients want their shares to be cleared at. Must be specified by execution-only clients.
Valid values are:
IBAwayPTA(post trade allocation)
delta_neutral_open_close: StringSpecifies 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.
delta_neutral_short_sale: boolUsed when the hedge involves a stock and indicates whether or not it is sold short.
delta_neutral_short_sale_slot: i32Indicates 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.
delta_neutral_designated_location: StringIdentifies third party order origin. Used only when deltaNeutralShortSaleSlot = 2.
basis_points: Option<f64>Specifies Basis Points for EFP order. The values increment in 0.01% = 1 basis point. For EFP orders only.
basis_points_type: Option<i32>Specifies the increment of the Basis Points. For EFP orders only.
scale_init_level_size: Option<i32>Defines the size of the first, or initial, order component. For Scale orders only.
scale_subs_level_size: Option<i32>Defines the order size of the subsequent scale order components. For Scale orders only. Used in conjunction with scaleInitLevelSize().
scale_price_increment: Option<f64>Defines the price increment between scale components. For Scale orders only. This value is compulsory.
scale_price_adjust_value: Option<f64>Modifies the value of the Scale order. For extended Scale orders.
scale_price_adjust_interval: Option<i32>Specifies the interval when the price is adjusted. For extended Scale orders.
scale_profit_offset: Option<f64>Specifies the offset when to adjust profit. For extended scale orders.
scale_auto_reset: boolRestarts the Scale series if the order is cancelled. For extended scale orders.
scale_init_position: Option<i32>The initial position of the Scale order. For extended scale orders.
scale_init_fill_qty: Option<i32>Specifies the initial quantity to be filled. For extended scale orders.
scale_random_percent: boolDefines the random percent by which to adjust the position. For extended scale orders.
hedge_type: StringFor hedge orders.
Possible values include:
D- DeltaB- BetaF- FXP- Pair
hedge_param: StringFor hedge orders. Beta = x for Beta hedge orders, ratio = y for Pair hedge order
account: StringThe account the trade will be allocated to.
settling_firm: StringIndicates the firm which will settle the trade. Institutions only.
clearing_account: StringSpecifies the true beneficiary of the order. For IBExecution customers. This value is required for FUT/FOP orders for reporting to the exchange.
clearing_intent: StringFor execution-only clients to know where do they want their shares to be cleared at.
Valid values are:
IBAwayPTA(post trade allocation)
algo_strategy: StringThe algorithm strategy.
As of API version 9.6, the following algorithms are supported:
ArrivalPx- Arrival PriceDarkIce- Dark IcePctVol- Percentage of VolumeTwap- TWAP (Time Weighted Average Price)Vwap- VWAP (Volume Weighted Average Price)
For more information about IB’s API algorithms, refer to https://www.interactivebrokers.com/en/software/api/apiguide/tables/ibalgo_parameters.htm
algo_params: Vec<TagValue>The list of parameters for the IB algorithm. For more information about IB’s API algorithms, refer to https://www.interactivebrokers.com/en/software/api/apiguide/tables/ibalgo_parameters.htm
what_if: boolAllows 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.
algo_id: StringIdentifies orders generated by algorithmic trading.
not_held: boolOrders 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.
smart_combo_routing_params: Vec<TagValue>Advanced parameters for Smart combo routing. These features are for both guaranteed and non-guaranteed 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://guides.interactivebrokers.com/tws/twsguide.htm#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
order_combo_legs: Vec<OrderComboLeg>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.
order_misc_options: Vec<TagValue>For internal use only. Use the default value XYZ.
active_start_time: StringDefines the start time of GTC orders.
active_stop_time: StringDefines the stop time of GTC orders.
scale_table: StringThe list of scale orders. Used for scale orders.
model_code: StringIs used to place an order to a model. For example, “Technology” model can be used for tech stocks first created in TWS.
ext_operator: StringThis is a regulatory attribute that applies to all US Commodity (Futures) Exchanges, provided to allow client to comply with CFTC Tag 50 Rules.
cash_qty: Option<f64>The native cash quantity.
mifid2_decision_maker: StringIdentifies 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+.
mifid2_decision_algo: StringIdentifies 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+.
mifid2_execution_trader: StringFor MiFID 2 reporting; identifies a person as the responsible party for the execution of a transaction within the firm. Requires TWS 969+.
mifid2_execution_algo: StringFor MiFID 2 reporting; identifies the algorithm responsible for the execution of a transaction within the firm. Requires TWS 969+.
dont_use_auto_price_for_hedge: boolDon’t use auto price for hedge.
auto_cancel_date: StringSpecifies the date to auto cancel the order.
filled_quantity: f64Specifies the initial order quantity to be filled.
ref_futures_con_id: Option<i32>Identifies the reference future conId.
auto_cancel_parent: boolCancels the parent order if child order was cancelled.
Identifies the Shareholder.
imbalance_only: boolUsed to specify “imbalance only open orders” or “imbalance only closing orders”.
route_marketable_to_bbo: boolRoutes market order to Best Bid Offer.
parent_perm_id: Option<i64>Parent order Id.
advanced_error_override: StringAccepts a list with parameters obtained from advancedOrderRejectJson.
manual_order_time: StringUsed 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.
min_trade_qty: Option<i32>Defines the minimum trade quantity to fill. For IBKRATS orders.
min_compete_size: Option<i32>Defines the minimum size to compete. For IBKRATS orders.
compete_against_best_offset: Option<f64>Specifies the offset off the midpoint that will be applied to the order. For IBKRATS orders.
mid_offset_at_whole: Option<f64>his 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.
mid_offset_at_half: Option<f64>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.
randomize_size: boolRandomizes the order’s size. Only for Volatility and Pegged to Volatility orders.
randomize_price: boolRandomizes the order’s price. Only for Volatility and Pegged to Volatility orders.
reference_contract_id: i32Pegged-to-benchmark orders: this attribute will contain the conId of the contract against which the order will be pegged.
is_pegged_change_amount_decrease: boolPegged-to-benchmark orders: indicates whether the order’s pegged price should increase or decreases.
pegged_change_amount: Option<f64>Pegged-to-benchmark orders: amount by which the order’s pegged price should move.
reference_change_amount: Option<f64>Pegged-to-benchmark orders: the amount the reference contract needs to move to adjust the pegged order.
reference_exchange: StringPegged-to-benchmark orders: the exchange against which we want to observe the reference contract.
adjusted_order_type: StringAdjusted Stop orders: the parent order will be adjusted to the given type when the adjusted trigger price is penetrated.
trigger_price: Option<f64>Adjusted Stop orders: specifies the trigger price to execute.
limit_price_offset: Option<f64>Adjusted Stop orders: specifies the price offset for the stop to move in increments.
adjusted_stop_price: Option<f64>Adjusted Stop orders: specifies the stop price of the adjusted (STP) parent.
adjusted_stop_limit_price: Option<f64>Adjusted Stop orders: specifies the stop limit price of the adjusted (STPL LMT) parent.
adjusted_trailing_amount: Option<f64>Adjusted Stop orders: specifies the trailing amount of the adjusted (TRAIL) parent.
adjustable_trailing_unit: i32Adjusted Stop orders: specifies where the trailing unit is an amount (set to 0) or a percentage (set to 1)
conditions: Vec<OrderCondition>Conditions determining when the order will be activated or canceled.
conditions_ignore_rth: boolIndicates whether or not conditions will also be valid outside Regular Trading Hours.
conditions_cancel_order: boolConditions can determine if an order should become active or canceled.
soft_dollar_tier: SoftDollarTierDefine the Soft Dollar Tier used for the order. Only provided for registered professional advisors and hedge and mutual funds.
is_oms_container: boolSet to true to create tickets from API orders when TWS is used as an OMS.
discretionary_up_to_limit_price: boolSet to true to convert order of type ‘Primary Peg’ to ‘D-Peg’.
use_price_mgmt_algo: boolSpecifies wether to use Price Management Algo. CTCI users only.
duration: Option<i32>Specifies the duration of the order. Format: yyyymmdd hh:mm:ss TZ. For GTD orders.
post_to_ats: Option<i32>Value must be positive, and it is number of seconds that SMART order would be parked for at IBKRATS before being routed to exchange.
customer_account: StringCustomer account information for completed orders.
professional_customer: boolIndicates if this is a professional customer order.
bond_accrued_interest: StringAccrued interest for bond orders.
include_overnight: boolInclude overnight trading.
manual_order_indicator: Option<i32>Manual order indicator.
submitter: StringIdentifies the submitter of the order.
Implementations§
Source§impl Order
impl Order
Sourcepub fn is_delta_neutral(&self) -> bool
pub fn is_delta_neutral(&self) -> bool
Returns true if delta-neutral parameters are configured.
Sourcepub fn is_scale_order(&self) -> bool
pub fn is_scale_order(&self) -> bool
Returns true if scale order parameters are configured.