Small bug in market depth reset error handler?

3 views
Skip to first unread message

shaggsthestud

unread,
May 3, 2009, 5:52:11 PM5/3/09
to JBookTrader
Doing some code mods I found this tidbit that has me confused, I think
it is a bug:

In Trader.error() the handler for error code 317 assumes that the ID
passed is the ID of a strategy. This error, I believe, is in response
to a request for market depth, which is passed a ticker number for the
ID. These may not be the same, for instance, if multiple strategies
are trading the same instrument.

Is this correct?

Eugene Kononov

unread,
May 3, 2009, 6:46:42 PM5/3/09
to jbook...@googlegroups.com
You may be right about this. This code was written some time ago, and I don't remember the semantics of the parameter "id" in the error(int id, int errorCode, String errorMsg) callback. I'll take a look at it and get back to you. My first thought is that it works as it should, because otherwise we would see a lot of NullPointerException on the line:
traderAssistant.getStrategy(id).getMarketBook().getMarketDepth().reset();

However, your understanding is correct in that error(int id, ...) is called back with the id that matches the one in the call socket.reqMktDepth(int id, ...), so I'll investigate.

shaggsthestud

unread,
May 19, 2009, 2:45:17 AM5/19/09
to JBookTrader
>My first thought is that it works as it should, because otherwise we
> would see a lot of NullPointerException on the line:
> traderAssistant.getStrategy(id).getMarketBook().getMarketDepth().reset();

Generally there should always be an equal amount or more strategies
than market books, hense why you don't see the problem.

> However, your understanding is correct in that error(int id, ...) is called
> back with the id that matches the one in the call socket.reqMktDepth(int id,
> ...), so I'll investigate.

Code should be, I believe:

if (errorCode == 317) {// Market depth data has been reset
traderAssistant.getMarketBook(id).getMarketDepth
().reset();
eventReport.report("Market depth data has been
reset.");
}

nonlinear5

unread,
May 25, 2009, 5:08:11 PM5/25/09
to JBookTrader
> Code should be, I believe:
>
>             if (errorCode == 317) {// Market depth data has been reset
>                 traderAssistant.getMarketBook(id).getMarketDepth
> ().reset();
>                 eventReport.report("Market depth data has been
> reset.");
>             }


I agree. This will be fixed as suggested in the next release.

nonlinear5

unread,
Jun 26, 2009, 4:23:17 PM6/26/09
to JBookTrader
Fixed in release 6.09. Thanks for reporting, shaggsthestud.
Reply all
Reply to author
Forward
0 new messages