[ts-gen] What is the "perm" column in OrderStatus?
pippin at owlriver.net
Mon Aug 24 14:52:58 EDT 2009
> ... "perm" field seems to be embedded in the filled [execution report
> messages] rather than the user-defined key ...
> Is this the identifier for an order (how I map from filled trade to my
> original order)?
As you suggest, it appears to uniquely identify orders when they are
described in execution reports. Since it is not accepted anywhere I
know of on the request side of the api, it's purely descriptive, and
not in my mind very useful.
> In the case below ... I am trying to associate this perm entry back
> to my user-defined sequential key.
> 18967|06014| 0.316406|3|11| 7|49|AUD
In the OrderReport table, you'll find, among other attributes:
perm int unsigned not null, -- ib perm id
client_id int unsigned not null, -- 20
order_tag int unsigned not null, -- 1 tick id
unique key(ibc, client_id, order_tag,
quad, perm, side, quantity, price),
The unique key declaration above is, admittedly, a bit verbose.
Client_id and order_tag might be sufficient, but here I prefer to
just capture whatever the IB tws gives us, and let postprocessing
worry about eliminating superfluous records, if any. As a foreign
key tuple, however, it is the (client_id, order_tag) pairs that
The client_id is the connection id that shows up in the banner, while
the order_tag is the numeric order id taken from the same numeric
sequence space as subscription tick ids, and often referred to, in an
abuse of terminology, as a tick id also. In any case, the client_id --
order_tag pair relates the command and message sides of the journal;
these pairs occur in CreateEvent, OrderStatus, ActiveOrder, and
OrderReport, corresponding to, on the message side, order status
(surprise!), open order, and execution report.
Note that this IB tws api practice of identifying orders via
connection id -- order id pairs is the reason that the connectin id
must be consistent from one risk mode session to the next in order
for cross-session order manipulation to work.
More information about the ts-general