IB API Help

Discussion in 'Automated Trading' started by walterjennings, Jan 11, 2007.

  1. Figured it out. Nevermind :D wont let me delete the post. mod feel free to delete the thread.
     
  2. Can't you just send a Cancel (Order#)?

    You should then get no more fills on that order.

    You know which orders filled and with how many shares from:

    virtual void orderStatus(OrderId id, const CString &status, int filled, int remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId)

    Parameters
    id - the order ID that was specified previously in the call to placeOrder()

    status - the order status. Possible values include:

    PendingSubmit - indicates that you have transmitted the order, but have not yet received confirmation that it has been accepted by the order destination. NOTE: This order status is not sent by TWS and should be explicitly set by the API developer when an order is submitted.

    PendingCancel - indicates that you have sent a request to cancel the order but have not yet received cancel confirmation from the order destination. At this point, your order is not confirmed canceled. You may still receive an execution while your cancellation request is pending. NOTE: This order status is not sent by TWS and should be explicitly set by the API developer when an order is canceled.

    PreSubmitted - indicates that a simulated order type has been accepted by the IB system and that this order has yet to be elected. The order is held in the IB system (and the status remains DARK BLUE) until the election criteria are met. At that time the order is transmitted to the order destination as specified (and the order status color will change).

    Submitted - indicates that your order has been accepted at the order destination and is working.

    Cancelled - indicates that the balance of your order has been confirmed canceled by the IB system. This could occur unexpectedly when IB or the destination has rejected your order.

    Filled - the order has been completely filled.

    filled - specifies the number of shares that have been executed.

    remaining - specifies the number of shares still outstanding.


    avgFillPrice - the average price of the shares that have been executed. This parameter is valid only if the filled parameter value is greater than zero. Otherwise, the price parameter will be zero.

    permId - the TWS id used to identify orders. Remains the same over TWS sessions.

    parentId - The order ID of the parent order, used for bracket and auto trailing stop orders.

    lastFilledPrice the last price of the shares that have been executed. This parameter is valid only if the filled parameter value is greater than zero. Otherwise, the price parameter will be zero.

    clientId - The ID of the client (or TWS) that placed the order. Note that TWS orders have a fixed clientId and orderId of 0 that distinguishes them from API orders.

    Notes
    This event is called whenever the status of an order changes. It is also fired after reconnecting to TWS if the client has any open orders
     
  3. Cool. Thanks for the info. I never bothered to learn this stuff before.