Limit orders at bid or ask, who gets filled first?

Discussion in 'Order Execution' started by zxd, May 4, 2010.

  1. zxd


    So lets say bid/ask is 4.15/4.16 for a stock

    I put a limit order at 4.15 for 1000 shares

    Let's say the size is like 200 (20,000 shares) or 1000 (100,000) at the bid

    I see fills going through at 4.15 (guessing at people who are selling at market), how does the market determine who gets filled first? Does it matter if using TD Ameritrade vs Interactive Brokers?
  2. Basically, it's called first in first out or FIFO.

    Bids and asks are like lineups, the people who arrived the earliest get filed.

    For stocks it can get more complicated because there will usually be multiple lines to wait in, different ECN's like ARCA or NSDQ Instinet. Generally if you put a limit order in early into a popular liquid ECN like those above, you'll be among the first in line to get filled. The size on the bid before your bid or ask order has priority.

    Most likely there is a default managed or smart order route that is set by default with those brokers (which you don't have to use), which directs the order automatically to a given ECN. This is okay for limit orders adding liquidity because the order ends up sitting in one of the above ECN's, but it can be cubersome for market orders where it would be better to transact directly through one of the ECN's.
  3. Not sure about order handling with IB or TD Ameritrade.

    However, if you have an order directly to an exchange, which I think you can specify with those brokers, the orders are handled in the order they are received. Orders to sell at bid or buy at ask are matched with whoever is first in line. When someone cancels their order or gets filled, the other orders move up in the queue.

    If the bid/ask has been moving down to 4.15/.16 from higher up that day, someone could have had a bid in at 4.15 from a long time ago, they are in line in front of you.

    I think you see limit orders at prices far from the market for a couple of reasons:

    1. If a big market order consumes a lot of limit orders, the price will often stabilize back somewhere near where it was before the order was absorbed. So, people like to have orders in so they can get an advantageous price providing liquidity during a small crunch. If the market creeps slowly to their limit orders, they just cancel them.

    2. Having lots of orders in so that _if_ the market reaches some price you want to trade at, you have a good position in the queue. If you don't want to trade at that price, you just cancel.

    These kinds of things are done with automation.
  4. Occam


    This is a pretty complex situation. There are many exchanges/ECN's/dark pools out there, most of which operate on price/time priority (you can google this for yourself if you want to know what that means). But each exchange/pool has its own queue.

    It's further complicated by the fact that, at many brokerages, customer orders that will take liquidity (the order selling at 4.15 in your example) may be "internalized" by the customer's own broker. This means that the broker decides to become the buyer at 4.15, and that the order will never see the outside world. (Payment-for-order-flow arrangements can yield similar results.) See also: