[ts-gen] multiple shims, client id's

Ken Feng kfmfe04 at gmail.com
Tue Aug 25 18:31:56 EDT 2009

Hi Bill,

Thank you for implementing this.
I just downloaded shim-20080824.tgz, and verified that it's working great.

My only question is, the ClientID key-value pair in .shimrc appears to
be neglected.  When I change it to:

ClientId        3

I get this when I try to bring up a new ./shim --data:

Maps:    1

          The trading shim has connected to the database server and
          loaded  51620 products.

Problem: 422 the client id  1 has not yet been released

                                    The IB tws offered api level 45,
          and connection negotiation resulted in an api level of 23
          and a client id of  2.  A query shows the account code to
          be XXXXXX.  Program initialization has been completed.


Now, I actually prefer your implementation where you increment client
id internally and post a warning "Problem: 422...", but I was
wondering, does this implementation render the ClientID entry in
.shimrc obsolete or does that ClientID refer to something else?

- Ken

On 8/13/09, Bill Pippin <pippin at owlriver.net> wrote:
> Back in June, Paul notes:
>> It appears that the shim no longer tries incrementing the client
>> id ... [when] another shim is running ...
>> ... data mode it gets stuck at 1; in risk mode it uses whatever
>> is in the .shimrc, but again will not increment if that value is
>> already taken. ...
> Belated thanks, Paul, for this report.  The problem has now been
> fixed.  I'd put off dealing with the issue until now since fairly
> substantial refactoring in open.c was needed, and I wanted to work
> on other features first.
> This bug has been mentioned a number of times on the list since Paul
> reported it, so others will probably be interested in the fix as well.
> E.g., from a post by Ken:
>> I wonder if there should only be one instance of the Shim running,
>> ... is there a way ... run one instance for pulling down prices,
>> and one for wiring orders ...
> Nils suggested the best possible work-around available at that time,
> of using two sessions, one each in --data and --risk mode (thanks
> Nils!).  That limitation no longer applies; users can now run multiple
> sessions in both data and risk modes up to the IB tws limit of eight
> concurrent sessions.
> >From the NEWS:
>>   Fix the handshake logic to retry on client id collisions,
>>   so that it is again possible for multiple data mode shim
>>   sessions to share the same account and IB tws gui session,
>>   and similarly, so that it is more convenient to have multiple
>>   concurrent risk mode sessions.  This restores a feature
>>   that was disabled as part of preliminary work on versioning
>>   earlier this year, and fixes a bug reported by PaulC ...
> Anyway, the solution involved splitting the VersionTable object into
> VersionTuple and VersionTable objects, where the client id, and client,
> server, and protocol api indices make up the VersionTuple, and the
> various version-specific event rules remain in VersionTable as before.
> For those who are interested, most of the changes were to open.c and
> version.h, and a comparison between those files from a couple of weeks
> ago and now will show the reader what changes were involved.
> Thanks,
> Bill
> _______________________________________________
> ts-general mailing list
> ts-general at trading-shim.org
> http://www.trading-shim.org/mailman/listinfo/ts-general

More information about the ts-general mailing list