how matching orders works
matching the orders of buyers and sellers is the primary work of specialists and market makers in the exchanges the matches happen when compatible buy orders and sell orders for the same security are submitted in close proximity in price and time generally a buy order and a sell order are compatible if the maximum price of the buy order matches or exceeds the minimum price of the sell order from there the computerized order matching systems of different exchanges use a variety of methods to prioritize orders for matching today most exchanges match orders using computer algorithms but historically brokers matched orders through face to face interactions on a trading floor in an open outcry auction quick accurate order matching is a critical component of an exchange investors particularly active investors and day traders will look for ways to minimize inefficiencies in trading from every possible source a slow order matching system may cause buyers or sellers to execute trades at less than ideal prices eating into investors profits if some order matching protocols tend to favor buyers and others favor sellers these methods become exploitable this is one of the areas where high frequency trading hft was able to improve efficiency exchanges aim to prioritize trades in a way that benefits buyers and sellers equally so as to maximize order volume the lifeblood of the exchange popular algorithms for matching ordersall major markets have transitioned to electronic matching each securities exchange uses its own specific algorithm to match orders broadly they fall under two categories first in first out fifo and pro rata under a basic fifo algorithm or price time priority algorithm the earliest active buy order at the highest price takes priority over any subsequent order at that price which in turn takes priority over any active buy order at a lower price for example if a buy order for 200 shares of stock at 90 per share precedes an order for 50 shares of the same stock at the same price the system must match the entire 200 share order to one or more sell orders before beginning to match any portion of the 50 share order under a basic pro rata algorithm the system prioritizes active orders at a particular price proportional to the relative size of each order for example if both a 200 share buy order and a 50 share buy order at the same price are active when a compatible 200 share sell order arrives the system will match 160 shares to the 200 share buy order and 40 shares to the 50 share buy order since the sell order is not large enough to fulfill both buy orders the system will partially fill both in this case the pro rata matching algorithm fills 80 percent of each order 