Dear Alexander, 
 
 

> What concerns the handling of order rejections, I have the following 
> question:
>  
> I would like to implement your code, but have seen that 
> 'reenableStrategies()' is not called from anywhere. Is the code you 
> submitted complete?
>
You are correct, the code was incomplete. For some reason the change to 
trader.java did not make into 
the patch.
The revised version of Trader.execDetailsEnd is below.

Klaus

    public void execDetailsEnd(int reqId) {

        try {

            Map<Integer, OpenOrder> openOrders = traderAssistant
.getOpenOrders();

            String msg = "Execution for this order was not found.";

            msg += " In all likelihood, this is because the order was 
placed while TWS was disconnected from the server.";

            msg += " This order will be removed and another one will be 
submitted. The strategy will continue to run normally.";


            for (OpenOrder openOrder : openOrders.values()) {

                String orderMsg = "Order " + openOrder.getId() + ": " + msg;

                eventReport.report(openOrder.getStrategy().getName(), 
orderMsg);

            }


            openOrders.clear();

            traderAssistant.resetOrderExecutionPending();

            traderAssistant.reenableStrategies();


        } catch (Throwable t) {

            // Do not allow exceptions come back to the socket -- it will 
cause disconnects

            eventReport.report(t);

        }

    }

-- 
You received this message because you are subscribed to the Google Groups 
"JBookTrader" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jbooktrader?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to