It seems the only place to get the execution commission for an API order is in the 'order state' structure, the problem is, how do you know when the last 'order state' (which actually arrives as part of an 'open order' message) arrives? In my testing, I see a multiple 'filled' statuses with zero shares remaining with accumulating commission fields, there seems to be no way of telling which is the last one...has anybody else solved this problem?
We made it easier to track commission via TWS API - see "Track Commissions with CommissionReport" section in 9.67 TWS API beta notes. Please feel free to contact our API support using email provided on the page above for more details, thank you.
I look for order state filled where attributes have changed as this method gets fired twice on order fills. You can download the full source from here http://code.google.com/p/trade-manager/ if (OrderStatus.FILLED.equals(transientInstance.getStatus()) && !transientInstance.getIsFilled() && !(orderState.m_commission == Double.MAX_VALUE)) { transientInstance.setIsFilled(true); transientInstance.setCommission(new BigDecimal( orderState.m_commission));
I've examined some of the messaging from today, you seem to be correct, it's the second filled message, I'll use this rule and keep an eye on what happens.
Yes what I do is store the orders sent then when updates come in I compare & null check the incoming msgs against what I already have and update as appropriate. Remember to synchronize these methods!! I dont use their reports but I do use IB TWS as the system of record. I subscribe to account updates and use these values to manage position sizing. I have found you can subscribe to real-timebars/market data/account updates all at the same time for multiple symbols (10-20) with no problems. You are limited to a max of 60 but my guess is most apps would have latency problems after 30 concurrent contracts. Remember the TWS API is just a layer over a message bus. Its a shame they dont just directly allow you to subscribe to the message bus without going through TWS. Thanks James
I have IB and eSignal. IB tends to be ahead of eSignal. I would not want to pay anymore for data feeds. I have used eSignal DDE interface for data but its slow and old technology. They do have other API's but they all cost more $$$
Out of curiosity, where do you see the latency coming from? Within the strategy logic itself as it processes a batch of new bars arriving...or with socket / network being able to move that many messages through efficiently? Or something else?