[ts-gen] The order mark, or brand [Was: ... create/submit/cancel ... ]

Bill Pippin pippin at owlriver.net
Tue Aug 11 12:28:00 EDT 2009


With respect to the order brand:

> One thing I found a little confusing is, the distinction between
> #{brand} and the order-key in #{take_pos} and #{exit_pos}.
> ... different commands may be [applied] to a specific orderID ...

Order keys absolutely must be unique per order.  They are critically
important, since they identify orders for later modification,
submission, and possibly, cancellation.  The order mark, OTOH ...

IANAL, and so I'll first quote from an email back in Dec,
It explains the addition of the brand parameter as a new, required
argument to the create command, first quoting from the [obsolete]
output of the risk.rb script at that time:

> create item test-pos 8 exit-pos-aa-081217-12-02-20 LMT 2 10.0  0.0;
> modify item            exit-pos-aa-081217-12-02-20 MKT 1  0.0  0.0;
> submit item            exit-pos-aa-081217-12-02-20;

and then giving the following explanation:

> In the text above, the string test-pos is the label, mark or
> brand.  This label is: stored as part of the CreateEvent record
> in the journal, as the request is sent; transmitted as part of
> the place-order request, as the order-ref attribute; received
> back from the IB tws as part of open order messages [if any];
> and stored by the shim with other parts of such messages in the
> ActiveOrder table.

> While we do not proffer tax advice, this order brand is intended
> for use in tracking the origin of orders.

Note the text immediately above; I make no assurances that the order
brand will be of any use, though you might like to know that we use
it to label orders for tracking purposes.

> Does this mean I can use #{brand} for anything I like?  As a strategy
> identifier, or to identify groups of entries and exits ... tax ...

As long as it's 96 characters or less, that being the field width in
the database, and recognized by the shim's scanner as a symbolic token
--- line noise is probably a bad idea --- and the IB tws doesn't
complain, you're fine.

Our design intent is that the shim not make other use of the brand
beyond the current approach, which is that the shim echo it upstream,
at least as long as the IB tws allows us to; store it in the command
side of the journal, that is the CreateEvent table; and capture it
in the various order related messages if and when the IB tws echoes
it back, where such events are then stored in the message side of
the journal.

Note also that you might choose to reuse a brand from an entry in an
exit, and that *might* have implications for how an accountant would
view your claims that the exit was a sale of shares from that entry,
as opposed to a sale of shares from some other position.  Again, IANAL,
or a tax accountant.

Note also that in their docs, IB refers to this place order request
attribute as being for institutional rather than individual investors,
and finally that your storage policies, and in particular your choice
of immutable or mutable media, might be of concern.  You are on your
own here.



More information about the ts-general mailing list