IB API Block Order Execution

Discussion in 'Order Execution' started by Darth-trader, Jul 9, 2016.

  1. I'm currently building out my own system using IB's API. One thing I am not certain on is how to keep track of block orders that can get executed at different times throughout the day e.g. Say if I have an order to sell 500 shares of AAPL at a certain price, I might get 100 shares filled at 10am, another 50 at 10:10am, maybe another 200 again later at 1:30pm and so on. I might even have a partial fill that is good till the day's end. My question is what fields in the Order Object will allow me to identify all these trades as part of the original block trade. Is it OrderId, PermId, ParentId, ClientId...?

    Im attempting to monitor not only these block orders and see if they get fully or partially filled but also orders that are sent but don't actually get executed.
     
  2. The order updates that come back are as cumulative fills (quantity done and average price over whole order) with the same OrderId as the original order, the same permid, but with different execid.

    Suppose you try and buy 10 lots, and you get fills of:
    • 3 lots @ 100.0
    • 6 lots @ 100.2
    • 1 lot @ 100.5
    Then the fills that come in will look like this:

    • qty: 3 lots, price=100.0
    • qty: 9 lots, price=100.13333333
    • qty: 10 lots, price=100.17

    There's more here

    http://qoppac.blogspot.co.uk/2014/05/the-placing-of-orders-to-interactive.html

    GAT
     
  3. Appreciate your reply. That site is also quite handy.

    I have a few questions as you appear knowledgeable on this area, some of which reference the site:

    1. so execid is a transaction id with each order id for each api call? If so, would i be correct in saying that execid is an id for each api call?
    2. orderid is good for the day and permid is good forever?
    3. When does orderid tick over?
    4. If I understand correctly, after market close (assuming I had orders that were GTC), if I make two status requests, the execid will be incremented (due to the API call) whilst all orderid and permid will stay constant. Is this correct? Im trying to understand execid vs orderid and permid.


    Thankyou
     
    Last edited: Jul 9, 2016
  4. 1. No as far as I know execid applies to each fill rather than API call. The API gets called when a fill happens, but also when you request the fills that have happened today.
    2. Yes
    3. When you submit an order to IB.
    4. I think the execid would remain the same for a given order on both occassions.

    GAT
     
  5. Thanks GAT. I will try experiment with the paper trade account.