order management with IB

Discussion in 'Automated Trading' started by ptunic, Oct 1, 2005.

  1. ptunic


    I use IB's Java API to get market data and that works great.

    Now I'm at a stage where I need to program automated order execution / order management.

    In general this doesn't look too hard, but I was wondering if anyone had insight or experience with programming order management to handle partial fills. It seems the logic for this could get a little burdensome; let's say the initial entry limit order fills with half, my program now needs to adjust the stop limit for the protective stop and target orders to be half the size. And/or I may want to place another limit order for the remaining # of contracts. Similarly, if the profit target gets a partial fill, maybe I need to send a market order for the remaining portion, or try again with another limit order at the same price or 1 tick worse fill possibly.

    Just curious if I'm on the right track, or if these issues are even more complex than I am anticipating..

  2. Of course it depends on what you want to do, but if you get a partial fill on a limit order, you will get an order status event showing number filled and number remaining, and the balance of the order remains sitting in the market until filled or cancelled. By it's nature you should never get a partial fill on a stop, although it may be filled at multiple prices.