[ts-gen] Unique Identifier for Orders

Ken Feng kfmfe04 at gmail.com
Wed Sep 9 21:10:02 EDT 2009


Hi Bill,

I'd like to open a discussion of unique identifiers for orders.

I thought I understood order_tag to be a shim-wide identifier for
orders so I tried to surmise the next order_tag by SELECT
MAX(order_tag)+1 - I was a little surprised today to see order_tag go
back to 1 when I upgraded to 090904 - I was expecting 57.  It looks
like a change in client_id from 8 to 4 may have been the culprit.

Ultimately, what I am trying to grasp is the unique order identifier
at these three levels:

1. My signal generator (my responsibility)
2. Shim - looks like order_id
3. TWS/IB - probably something other than order_id

I need to tie together all three order_id's in a one-to-one-to-one
relationship, or I will get myself in trouble.  In particular, I care
about binding 1. to 2. carefully as my signal generator will generate
a row in MySQL before the Shim generates an order_id so I have a
little bit of a chicken-and-egg problem here (hence my hacky SELECT
MAX(order_tag)+1 above).

Thanks in advance.

- Ken


More information about the ts-general mailing list