|
Fields in Orders |
Top Previous Next |
|
These are the various fields, which are called property.
Changed: Boolean;
Identifies if the Filled value has just changed. Check this to indicate if the last OnOrderStatus notification from TWS actually amended the Filled quantity. This is more reliable than interpreting the various order status. (read and write).
The Changed property is reset to false when an order status changes, but the filled quantity does not.
Completed: Boolean;
Completed is true when an order is successfully cancelled, or an order is completely filled, otherwise false. Value is set automatically from notifications from TWS (read and write).
TempId: Integer;
The TempId is the identity used by TWS to identify this order. See also ClientId. (read and write).
PermId: Integer;
PermId is created by TWS, and is filled in by TIABSocket component when first discovered. (read and write).
ClientId: Integer;
ClientId that generated this Order. If the order was made from the TWS, then ClientID is 0. If you run Patterns, set ClientID to 1. You may open Patterns again, and create another order. In this case, set ClientId to 2 for the second Patterns.
Filled: Integer;
Total volume of executed filled shares / contracts for this order. Updated automatically. (read and write).
Remaining: Integer;
Remaining of open volume of shares / contracts for this order. Updated automatically. (read and write).
FillPrice: Double;
Current fill price of executed shares. This value is the average price for all fills in this order so far. Updated automatically. (read and write).
LatestFillQty: Integer;
The last number of filled shares / contracts when a partial fill occurs. Updated automatically. (read and write).
LatestFillPrice: Money;
The price of the last filled shares / contracts when a partial fill occurs. This is the price of the portion of LatestFillQty shares / contracts. Updated automatically.
Note: API version 7.01 The TWS now sends this data. Prior versions the TWS does not send this data - it is a calculated value from the current accumulated Price. The TWS usually only goes to 4 decimal places, and often this isn't enough to calculate the actual price exactly of each partial fill portion. I recommend you use some rounding on this property. (read and write).
Account: string;
For institutional customers only. Account number / name. (read and write).
Action: TIABAction;
TIABAction = (Idle,Buy,Sell,Short,Exercise,Lapse);
Sets the action (buy, sell, short) for this order when passed to the PlaceOrder method. For Options use the ExerciseOptions method and the action set to Exercise or Lapse. Changing this property does not send the order. (read and write).
AuxPrice: Money;
This is the STOP price for stop-limit orders, and the offset amount for Relative orders and Trail orders. In all other cases, specify zero. (read and write).
The auxprice is the amount by which IB substracts from the last price to get the stop price.
If lastprice changes to 52 and your aux price is set to 1.00 - then your stop price becomes 51. If lastprice drops to 51.5 - your stop price for a sell is still 51. (51 is still higher than 50.5) If lastprice moves up to 53 - your stop price for a sell will be 53-1 = 52. (52 is higher than 51)
The aux price does not shrink unless you change the order yourself. I.e. stop price does not come down for a sell order, it either goes up or you get stopped out at the last stop price. That's theory - please check it out with your paper account - I notice it sometimes doesn't work especially when it is very volatile, in particular for futures, the price can drop drastically - don't forget the stop becomes a market order.
Currency: string;
Specifies the currency. This field is only required when the SecurityType = stCash. Otherwise it is ignored. (read and write).
Exchange: string;
The order destination such as 'SMART' or 'GLOBEX'. NOTE: When you connect to TWS using any of the API components, you must route all U.S. stock and option orders through Smart order routing. (read and write).
Note: see also PrimaryExchange property.
Expiry: string;
The expiration date of a Future or Option.
LocalSymbol: string;
This is the local exchange symbol of the underlying asset.
OCAgroup: string;
Identifies an OCA (one cancels all) group. Set this to any unique string, and all open orders with same value, will be tied together. (read and write).
OpenClose: string;
For institutional customers only. Specifies whether the order is an open or close order. Valid values are 'O', 'C'. (read and write, default = 'O').
OrderRef: string;
For institutional customers only. The order reference. (read and write).
OrderOrigin: TIABOrderOrigin;
TIABOrderOrigin = (Customer,Firm,Unknown); (read and write).
OrderType: TIABOrderType;
NoChange, Market,Limit, Stop,StopLimit, Relative,VWAP, MarketClose, LimitClose, Trail,LimitOpen, MarketOpen,OneCancelOrder, ISEBlock,PegMarket, Volume,TrailLimit, None, Unknown
Use NoChange for a call to ModifyOrder only. Not all order types are supported in the API as yet.
Quantity: Integer;
Order share / contract quantity.
Price: Money;
Order limit price. Maximum precision is 6 places. The TWS may limit this further depending on the asset. (read and write).
Right: TIABRight; For options. TIABRight = (None, Put,Call).
SecurityType: TIABSecurityType;
Stock, Option,Future, Index,FutOpt, Cash,Bag, Bond
Strike: Money; For options.
Symbol: string; This is the symbol of the asset.
TrailStopPrice: Money;
For Trailing stop limit orders. Use the order type of TrailLimit. When placing trailing stop limit orders, the AuxPrice property specifies the trailing amount, and the stop price is specified as this TrailStopPrice property.
TimeInForce: TIABTimeInForce;
Values are Day, GoodTilCancelled, ImmediateOrCancel(FillOrKill), opg(?), Good Till Date (read and write).
Transmit: Boolean;
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.
ParentId: Integer; The order ID of the parent order, used for bracket and auto trailing stop orders.
BlockOrder: Boolean; If set to true, specifies that the order is an ISE Block order.
SweepToFill: Boolean; If set to true, specifies that the order is a Sweep-to-Fill order.
Multiplier: string;
The desired futures or options contract multiplier in any API operation that involves describing a contract. These operations are: placing orders, requesting market data, requesting market depth, and requesting contract (instrument) specifications. An example of when this functionality is useful is when a corporate action has resulted in more than one options contract being traded on the same underlying, with the same right (put or call), strike, and expiration. If a contract only trades with a single multiplier (typically 100), specifying the multiplier is not necessary.
DisplaySize: Integer;
The publicly disclosed order size, used when placing Iceberg orders.
ShortSaleSlot: Integer;
Retail customers set to a value of 0.
Institutional (ie non-cleared) customer specify "Short Sale Slot" information when placing an order of side "SSHORT." This information concerns the location from which shares will be delivered, and has two parameters, "Short Sale Slot" and "Designated Location." If "Short Sale Slot" is 1, then shares will be delivered from the customer's clearing firm, and no "Designated Location" is specified. If "Short Sale Slot" is 2, then shares will be delivered from a "Designated Location" clearing firm, and the value of "Designated Location" is a comma-delimitted list of possible firms.
TriggerMethod: Integer;
Specifies how Simulated Stop, Stop-Limit and Trailing Stop orders are triggered. Valid values are: O - the default value. The "Money bid/ask" method will be used for orders for OTC stocks and US options. All other orders will used the "last" method.
1 - use "Money bid/ask" method, where stop orders are triggered based on two consecutive bid or ask prices.
2 - "last" method, where stop orders are triggered based on the last price.
3 - "Money-last" method, where stop orders are triggered based on last two prices.
ExtendedHours: Boolean;
If set to true, allows triggering of orders outside of regular trading hours. (read and write).
Hidden: Boolean;
If set to true, the order will not be visible when viewing the market depth. This option only applies to orders routed to the ISLAND exchange. (read and write).
ShareAllocation: string;
Specifies the number of order shares allocated to each FA managed account. The format of the allocation string is as follows:
<account_code1>/<number_shares1>,...
For example, to allocate 20 shares of a 100 share order to account 'U101' and the other 80 shares to account 'U203', enter the following share allocation string: U101/20,U203/80
DiscretAmount: Money; Field discretionaryAmt - unknown purpose?
FAdvGroup: string; For Finacial Adviser accounts, otherwise a blank string '';
FAdvMethod: string; For Finacial Adviser accounts, otherwise a blank string '';
FAdvPercentage: string; For Finacial Adviser accounts, otherwise a blank string '';
FAdvProfile: string; For Finacial Adviser accounts, otherwise a blank string '';
GoodAfterTime: string;
The trade's "Good After Time,"
GoodTillDate: string;
The trade's "Good Till Date,"
PrimaryExchange: string;
Specify the PrimaryExchange for Smart Routing.
You must specify the primary exchange when placing orders routed through SMART exchange, or when making SMART market data requests. Specifying the primary exchange allows the API to resolve routing ambiguities for example in instances when an asset trades in the same currency on multiple exchanges (i.e. QQQ trades in US dollars on both AMEX and NYSE). Note that the primary exchange for NASDAQ-traded products is SUPERSOES.
DesignatedLocation: string;
Unknown... see TWS help.
OcaMethod: TIABOcaMethod;
CancelWithBlock, ReduceWithBlock, ReduceNonBlock
RegTradingHoursOnly: Boolean;
Rule80A: TIABRule80A;
Individual, Agency, AgentOtherMember, IndividualPTIA, AgencyPTIA, AgentOtherMemberPTIA, IndividualPT, AgencyPT, AgentOtherMemberPT
OverridePercentageConstraints: Boolean;
Overrides TWS's order price percentage constraints, which are applied to orders that TWS sees as deviating too much from the NBBO of the contract. This functionality was put into place to work in conjunction with the fact that TWS will no longer pop up a confirmation dialog when an API order violates the percentage constraints TWS imposes. If this is set to false, such orders going forward will be rejected. Keep in mind that orders with prices that severely depart from the contract's NBBO but would otherwise be filled will be rejected by IB's servers.
SettlingFirm: string; Pertains to institutional only.
AllOrNone: Boolean;
MinQuantity: Integer; Minimum quantity.
PercentOffset: Money; Pertains to relative orders only.
ETradeOnly: Boolean;
FirmQuoteOnly: Boolean;
Trade with firm quotes..?
NBBOPriceCap: Money;
Maximum SMART order distance from the NBBO
AuctionStrategy: TIABAuctionStrategy;;
TIABAuctionStrategy = (Unset, Match, Improvement, Transparent);
StartingPrice: Money; StockRangeUpper: Money; StockRangeLower: Money; Delta: Money; StockRefPrice: Money;
The following are for BOX orders:
All volatility orders have these two parameters:
Volatility: What the price is computed from via TWS's options analytics. For VOL orders, the limit price sent to an exchange is not editable, as it is the output of a function. Volatility is expressed as a percentage.
VolatilityPeriod: Set to UnSet, Daily or Annual.
Dynamic volatility orders have these five additional parameters:
DeltaNeutral: Specifies whether TWS is supposed to do the corresponding delta trade upon full or partial execution of the option order. If delta neutral is selected, market orders in the underlier will be placed in response to executions to maintain delta-neutrality.
ContinuousUpdate: Whether TWS is supposed to update the order price as the underlier moves. If Continuous Update is selected, the limit price sent to an exchange is modified by TWS if the computed price of the option changes enough to warrant doing so. This is very helpful in keeping the limit price sent to the exchange up to date as the underlier price changes.
ReferencePrice: UnSet, Average or BidOrAsk. Set to Average for Average of National Best Bid or Ask, or set to BidOrAsk for National Best Bid when buying a call or selling a put, and National Best Ask when selling a call or buying a put. The reference price is used to compute the limit price sent to an exchange (whether or not Continuous Update is selected), and for watermark price monitoring. |