[ts-gen] Test.rb

Bill Pippin pippin at owlriver.net
Wed Jul 7 19:20:49 EDT 2010


Ric,

With respect to your post at the tail end of last month:

http://www.trading-shim.org/pipermail/ts-general/2010-June/000769.html

Glad to see you've downloaded a new shim.  Although I may be noting
the obvious, others may be interested to know that I periodically
announce releases to freshmeat, using much less detail than on this
list, so that a quick way to see what's been happening with the shim
is to look up the trading-shim at http://www.freshmeat.net .  Again,
there is much, much less information there than is found on this list,
or for that matter in the NEWS file.

Your report about test.rb reflects a known issue.  From the NEWS file:

  * ... reimplement the past.rb script to process events, check for
    returned data, and terminate based on such results.  These changes
    do, however, break the test.rb script ...

It's convenient that you brought it up, however; I have several points
to make in response:

    1.  Past.rb, test.rb, and risk.rb are intended to share common
        code where feasible, and use class derivation to implement
        the necessary differences.

    2.  Past.rb and test.rb currently share a substantial amount of
        code, and it is the changes to past.rb, as noted above, that
        have broken test.rb.

    3.  This is unimportant for regression testing, since exs/test,
        a straight-line shim script, has about the same functionality,
        which is in part why I haven't felt the need to revise and
        update test.rb.

    4.  The breakage you mention is, I believe, a mismatched call
        parameter list, and the more critical problem is loss of
        termination, since the changes for past.rb include a new
        requirement over the shared classes that the client define a
        derived-class method for the termination test.

    5.  Risk.rb needs to be extensively revised to fit the framework
        provided by the common code already used by test.rb and past.rb,
        the ruby class definition files found in the rsc, ruby sample
        client, directory, and once this is done, the script can be
        controlled via message feedback, so that, using both message
        feedback and the new OrderLag variable, the explicit timeouts
        can be removed (good riddance), and the whole provide a good
        starting point for other, user-specific downstream order
        scripts.

    6.  One of the benefits of the common code is a shared approach to
        message handling, unfortunately for now based on a case switch.

    7.  This should be improved in the future via database tables that
        define message structure, such as indices, message length, and
        attribute type.  Sorry, not sure when they'll be ready; they
        *may* be implemented as a part of api versioning for the shim.

The need for furthur work and improvements to the shared ruby
classes leads me to my main point, for which your question is a
great introduction:

> I am very interested in the new rsc, any doc or hints on what
> this is and how one can get involved/help?

The ruby sample client directory, rsc, is as implied above, the home
for shared ruby class files to be used by scripts such as test.rb, 
past.rb, and, hopefully in the future, risk.rb.  It should eventually
provide a useful example to users intending to implement their own
downstream api command send / message receipt code.

The primary documentation at this time is the comment text at the top
of each ruby class definition file.  The following annotated results of
grep may also be of interest:

    rsc$ grep '^class' *.rb

    CmdArgText.rb: class CmdArgText # parameterize shim startup via mode,
                                    # opts, and init option let statement
    Popen3Shim.rb: class Popen3Shim # popen3 setup
    SampleTest.rb: class SampleTest # higher-order test harness, via proc
    SelectRead.rb: class SelectRead # bsd-select() multiplexed input loop
    ProcFilter.rb: class ProcFilter
    ProcFilter.rb: class TestFilter < ProcFilter # test.rb
    ProcFilter.rb: class PastFilter < ProcFilter # past.rb

    Generation.rb: class Generation              # cmd generator base class
    CannedCmds.rb: class CannedCmds < Generation # test.rb, regression tests
    CrossQuery.rb: class CrossQuery < Generation # past.rb, cross product
    CreateCmds.rb: class CreateCmds              # test.rb and past.rb

    ModToTaste.rb: class ModToTaste # past.rb; symbol and other info

In the text above, the less than sign indicates class derivation,
in accord with ruby syntax.  The proc filter derived class handles
all message case handling, and is where the bulk of the useful
individualized work is done; it's a parameter to the test harness.
The termination test provided by the proc filter is used by the
select loop class.  Currently, the code is focused on regression
testing, though in the future I'd like to see it evolve to provide a
full-fledged framework for, as the name indicates, a ruby sample
client for the IB tws api.

That being said, my focus for now is the shim.  So, if you are interested
in adding to the ruby code, feel free to post on the list, realizing that
at this time I don't have the time to hold up my end of the dialogue,
although I hope others will step in.  In addition, if you want to add to
the code in the release, please discuss guidelines for code submission
with Russ.

I'm delighted that you asked about the rsc code, and hope that you can
contribute to it.  Please realize that, for now, I lack the time to do
so myself.

Thanks,

Bill


More information about the ts-general mailing list