IB API ordering

Discussion in 'Automated Trading' started by Iljah, Aug 19, 2010.

  1. Iljah


    Hi all,

    I've written a framework to implement strategys for automated trading, using Java and the TWS API. Till now trading works fine on the paper trading account (still testing and debugging), even for several days with automatic reconnect and all those features. But I've sent each order (trading forex pairs) to the TWS like "fire and forget". This means I calculated the commission on my own, based on the actual bid or ask. Since orders in my "dimension" are always filled.

    Now: To improve my work I currently add the handling of incoming order messages and got a few questions.

    The TWS calls these three functions:

    openOrder() - contains the ID and the order state with: OrderStatus, Commission (Min, Max, Total, Currency) and some more
    orderStatus() - contains the ID and the order state, avg fill price and some more
    execDetails() - contains the ID and an execution with another orderid, avg fill price, cumulative quantity

    This leads me to the following questions:

    1) Why is there such a large redundancy with avg fill prices, quantitys etc.
    2) The orderId of the execDetails is -1. The orderId in the Execution-Object ist correctly mapped to my reffering order. Why ?
    3) The min AND max commission is (in my last order) stated with: 1.7976931348623157E308. Why? I would think +inf and -inf. But both +?
    4) I traded Eur.Jpy and the last orderStatus call gave me a commission of 2.5 with a currency JPY. But the trade was to small. Thus the 2.5 is the min commission in USD. Is the currency always in USD? Or just in USD if its below the minimum?? Or even random? ;)

    It is not that easy to get the most important and reliable information out of them. Any instructions or experiences would be great.

    With regards,
  2. Iljah


    Sorry for massive double posting. I asked the support to delete these threads. I submitted them yesterday but they did not appear.

    Sorry .. will never happen again. :(
  3. cstfx


  4. Iljah


    Ok thanks. I will give a try!