30

Say a security has been trading at under $20.10, and there are limit orders selling at $20.10 and $20.21. Then Simon issues a limit order to buy at $20.21. According to this explanation, Simon would end up buying shares at $20.10.

Why does the exchange favor the buyer here? I.e., why does the transaction execute at the seller's limit of $20.10 instead of the buyer's limit of $20.21? (I.e., why don't Inara/River get to sell at $20.21 / above their limit, but Simon gets to buy at $20.10 / below his limit?) Is the example flawed?

If it makes a difference, I'm mainly curious about NASDAQ and NYSE. I tried Googling for specs (e.g. this), but couldn't find anything. Only found that some random limit order book implementation executes the average of the buy/ask. Just curious how the system works.

  • 2
    You can't fill the limit sell order at 20.21 before the limit sell order at 20.10 is executed. It's against the price priority. That's why the limit sell orders at 20.10 are executed first. In this case, because the limit buy order is above the lowest limit sell order, the limit buy order get executed until its fully filled, or that all the limit sell order below 20.21 are filled. – Mesop May 25 '12 at 7:32
  • There is a similar question "If you put a sell limit order in 5% below where a stock is currently trading, what happens?": answers.yahoo.com/question/index?qid=20100729193903AAO0jw7 – Mesop May 25 '12 at 7:33
  • 1
    I was JUST going to ask this question, it's so nice when SE already has the answer, thanks to Dheer and xyz :) – Void Star Dec 2 '13 at 7:13
  • In that article (thanks for the link!), he mentions that the best price will be filled first. Best price is from buyer's point of view. This does not answer your why, this is more like a justification I guess. – Victor123 Jan 21 '14 at 3:25
29

The Limit Order are matched based on amount and time. The orders are listed Highest to Lowest on the Buy Side. The orders are listed Lowest to Highest on the Sell Side. If there are 2 Sell orders for same amount the order which is first in time [fractions of milliseconds] is first.

Buy-Sell

The about is the example as to how the orders would look like on any exchange. Now the highest price the buyer is ready to pay is 20.21 and the lowest price a seller is ready to sell for is 20.25. Hence there is no trade.
Now if a new Buy order comes in at 20.25, it matches with the sell and the deal is made.
If a new Buy order comes in at 20.30, it still matches at 20.25.
Similarly if a Sell order come in at 20.21, it matches and a deal is made.
If a Sell order come in at 20.11, it still matches 20.21.

Incase of market order, with the above example if there is a Buy order, it would match with the lowest sell order at 20.25, if there is not enough quantity , it would match the remaining quantity to the next highest at 20.31 and continue down. Similarly if there is a Sell market order, the it would match to the maximum a seller is ready to buy, ie 20.21, if there is not sufficient buy quantity at 20.21, it will match with next for 20.19

If say there are new buy order at 20.22 and sell orders at 20.24, these will sit first the the above queue to be matched.

In your above example the Lowest Sell order was at 20.10 at time t1 and hence any buy order after time t1 for amount 20.10 or greater would match to this and the price would be 20.10.
However if the Buy order was first ie at t1 there was a buy order for 20.21 and then at time later than t1, there is a sell order for say 20.10 [amount less than or equal to 20.21] it would match for 20.21.
Essentially the market looks at who was the first to sell at lower price or who was the first to buy at higher price and then decide the trade.

Edit [To Clarify xyz]:
Say if there is an Sell order at $10 Qty 100. There is a buyer who is willing to pay Max $20 and is looking for Qty 500. Your key assumption that the Buyer does not know the current SELL price of $10 is incorrect.
Now there are multiple things, the Buyer knows the lowest Sell order is at $10, he can put a matching Buy order at $10 Qty 100, and say $11 Qty 100 etc. This is painful.
Second, lets say he puts a Buy order at $10 Qty 100, by the time the order hits the system someone else has put the trade at $10 and his order is fulfilled. So this buyer has to keep looking at booking and keep making adjustments, if its a large order, it would be extremely difficult and frustrating for this Buyer. Hence the logic of giving preference.
The later Buy order says ... The Max I can pay is $20, match eveything at the current price and get the required shares.

  • Thanks for the explanation - I believe the key answer was in your final paragraph. Can you point to a source where I can verify this information? It's odd that the exchange would give an advantage to the party that comes later (since you're saying the trade executes at the price of whoever is just arriving, buyer or seller, assuming the limits overlap/are mutually satisfying). – xyz May 23 '12 at 9:26
  • 6
    The priority of order execution is called Price/Time priority. The order are executed at the best price, with the oldest limit order (at that best price) in the book (some exchanges introduced a membership that put the order of the member before the order of the non member to have a Price/Member/Time priority). – Mesop May 23 '12 at 11:33
  • 1
    @olchauvin Yes, but again, what is "the agreed price"? (Ignoring matches against multiple orders for now.) If you're selling for as low as $10 and I'm buying for as high as $20, then what do we transact at? $10? $20? $15? Dheer's answer is that whoever came last gets the best deal. So if you were waiting and then I come in, then we transact at $10, so you get the least amount of money. Hope my question is more clear. – xyz May 25 '12 at 8:11
  • 1
    @xyz, What point are you trying to say? What do you mean by source, this is common sense isn't it? Whoever comes first gets the lousy deal, whoever comes second gets the best deal, and whoever comes later than the second gets no deal. HFT firms are racing for the last deal. – Pacerier Dec 1 '13 at 0:26
  • 2
    @xyz ok So we have 2 people wanting to trade. One of them can afford to wait more than the other guy. It makes sense that the person who can afford to wait gets the better deal right? The person who urgently needs the order to get filled does not have much say in the price. Fair? – Pacerier Dec 2 '13 at 2:23
4

The total limit book is a composite of all the orders on all of the exchanges.

While it's uncommon for a limit order posted beyond the NBBO to fill outside of the NBBO, it does occur.

For example, the best ask may be on exchange X, but for some reason the smart order routing algorithm may select exchange Y if it judges the net trade to be less costly, malfunctions, etc, and HFTs will immediately arbitrage the order between two exchanges, or the best order on exchange X disappears causing the order to fill above the NBBO.

The system isn't perfect because there are multiple exchanges, but that eventuality is extremely rare with equities since nearly every exchange will have orders posted at the NBBO because exchange equity fee and rebate schedules are extremely competitive, nearly identical. It is however more common with options since less exchanges as a percentage of the total will have orders posted at the NBBO because of very wide exchange rebate and fee schedules.

How a single exchange handles a new order that crosses an existing limit order is already addressed here: How do exchanges match limit orders?

  • Any sources to quote? – Pacerier Nov 30 '13 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.