[ts-gen] Problems with create/submit/cancel [Was: Cancel Order and OCA Orders]

Ken Feng kfmfe04 at gmail.com
Tue Aug 11 04:32:51 EDT 2009

Hi Bill,

After I downloaded shim-090807, your cancel example works great.  I
must've broken the parser in shim-090715 while trying to patch it to
work with forex, or more likely, I broke the database with my SQL.  I
use your truncate suggestion now, if I need to clean, but I have
stopped hard-coding the order keys;  btw, after your fixes in 090807,
I have found that I no longer need to patch at all!

Your detailed explanation is very useful - saves me time from having
to figure out strange timing behavior between tws/shim.  Also, your
meticulous explanation of the timing key is much appreciated - I
initially hard-coded the key just to see if I could get it to work,
but now that I see it does, I wholeheartedly copy your example to
generate my key.  I will consider your "using the brand for tax
accounting" hint a little later on.  I suppose the brand could also be
used to distinguish between multiple trading strategies.

One thing I found a little confusing is, the distinction between
#{brand} and the order-key in #{take_pos} and #{exit_pos}.  They are
both just identifiers, correct?  But the difference being that
#{brand} is a higher level marker for anything you like (doesn't need
to be unique between orders, it looks like) whereas #{take_pos} and
#{exit_pos} are lower level, higher granularity identifiers (that have
to be sequential) that is mapped directly to a particular, correct?
But different commands may be sent to a specific orderID in
#{take_pos} or #{exit_pos}.

Does this mean I can use #{brand} for anything I like?  As a strategy
identifier, or to identify groups of entries and exits (maybe for tax
purposes), etc...?  I suppose there must be a bunch of tables from
which I can query for #{brand} or perhaps even use it for a GROUP BY

I really appreciate you taking the time to explain things in detail.
I am very eager to try out the parent-child OCA functionality you
mentioned in your other e-mail.

Thx again.

- Ken

On 8/11/09, Bill Pippin <pippin at owlriver.net> wrote:
>     sequence = "-aa-"
>     identity =  sequence  + Time.new.strftime("%y%m%d-%H-%M-%S")
>     take_pos = 'take-pos' + identity
>     exit_pos = 'exit-pos' + identity
>     brand    = 'test-pos'
>     create item #{brand} ibc:265598 at SMART #{take_pos} LMT 2 100.0  0.0;
> I don't go to the trouble to vary the brand, which for operational
> orders and real-life tax accounting is a mistake, but at the very
> least the shim *has* to see different order keys, or it thinks you
> are trying to modify the order, which is not allowed for the create
> command.

More information about the ts-general mailing list