IB Commissions though API

Discussion in 'Automated Trading' started by Craig66, Jun 12, 2012.

  1. Craig66


    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?
  2. dst

    dst Interactive Brokers

    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.
  3. 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


    if (OrderStatus.FILLED.equals(transientInstance.getStatus())
    && !transientInstance.getIsFilled()
    && !(orderState.m_commission == Double.MAX_VALUE)) {
    transientInstance.setCommission(new BigDecimal(
  4. Craig66


    Thanks, I'll check that out.
    Have you tried it with 'unbundled' commissions?
  5. Craig66


    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.
  6. 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.

  7. Craig66


    I don't even bother with IB data, I use IQFeed.
  8. 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 $$$
  9. 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?