Price/Time priority order matching - limit order starvation
"Market orders do not get priority over limit orders.  Time is the only factor that matters in price/time order matching when the order price is the same. For example, suppose the current best available offer for AAPL is $100.01 and the best available bid is $100.00.  Now a limit buy for $100.01 and a market buy arrive at around the same instant.  The matching engine can only receive one order at a time, no matter how close together they arrive. Let's say that by chance the limit buy arrives first.  The engine will check if there's a matching sell at $100.01 and indeed there is and a trade occurs.  This all happens in an instant before the matching engine ever sees the market buy.  Then it moves on to the market buy and processes it accordingly. On the other hand, let's say that by chance the market buy arrives first.  The engine will match it with the best available sell (at $100.01) and a trade occurs.  This all happens in an instant before the matching engine ever sees the limit buy.  Then it moves on to the limit buy and processes it accordingly. So there's never a comparison between the two orders or their ""priorities"" because they never exist in the system at the same time.  The first one to arrive is processed first; the second one to arrive is processed second."
This is rather simple if you understand a trailing limit order but to be sure I am going to explain a limit, trailing limit, and trailing LIT order. I am going to use an example assuming that you already own a stock and want to sell it. Limit Order I place an order to sell 100 PG @ 65.00. This order will only be executed if the bid price of PG is at $65.0000 or greater. Trailing Limit Order I place an order to sell 100 CAT @ 85.25 with a trailing 5%. This order will be executed when CAT drops 5% below the highest point it reaches after you place this order. So if you place this order at 85.25 and the stock drops 5% to $80.9875, your order will be executed. However, if the stock jumps to $98, the order will not be executed until the stock falls to $93.10. The sell point will go up with the stock and will always remain at the specified % or $ amount behind the high point. Trailing Limit If Touched Order I place an order to sell 100 INTC @ 24.75 with a trailing 5% if the stock touches $25.00. Essentially, this is the same as the trailing limit except that it doesn't take effect until the stock first gets $25.00.  I think the page they provide to explain this is confusing because I think they are explaining it from the shorting a stock perspective instead of the selling a stock you want to profit from. I could also be wrong in how I understand it. My advice would be to either call their customer support and ask for a better explanation or what I do in my finances, avoid things I don't understand. In order to see whether you can buy or sell some given quantity of a stock at the current bid price, you need a counterparty (a buyer) who is willing to buy the number of stocks you are wishing to offload. To see whether such a counterparty exists, you can look at the stock's order book, or level two feed. The order book shows all the people who have placed buy or sell orders, the price they are willing to pay, and the quantity they demand at that price. Here is the order book from earlier this morning for the British pharmaceutical company, GlaxoSmithKline PLC.  Let's start by looking at the left-hand blue part of the book, beneath the yellow strip. This is called the Buy side. The book is sorted with the highest price at the top, because this is the best price that a seller can presently obtain. If several buyers bid at the same price, then the oldest entry on the book takes precedence. You can see we have five buyers each willing to pay 1543.0 p (that's 1543 British pence, or £15.43) per share. Therefore the current bid price for this instrument is 1543.0. The first buyer wants 175 shares, the next, 300, and so on. The total volume that is demanded at 1543.0p is 2435 shares. This information is summarized on the yellow strip: 5 buyers, total volume of 2435, at 1543.0. These are all buyers who want to buy right now and the exchange will make the trade happen immediately if you put in a sell order for 1543.0 p or less. If you want to sell 2435 shares or fewer, you are good to go. The important thing to note is that once you sell these bidders a total of 2435 shares, then their orders are fulfilled and they will be removed from the order book. At this point, the next bidder is promoted up the book; but his price is 1542.5, 0.5 p lower than before. Absent any further changes to the order book, the bid price will decrease to 1542.5 p. This makes sense because you are selling a lot of shares so you'd expect the market price to be depressed. This information will be disseminated to the level one feed and the level one graph of the stock price will be updated. Thus if you have more than 2435 shares to sell, you cannot expect to execute your order at the bid price in one go. Of course, the more shares you are trying to get rid of, the further down the buy side you will have to go. In reality for a highly liquid stock as this, the order book receives many amendments per second and it is unlikely that your trade would make much difference. On the right hand side of the display you can see the recent trades: these are the times the trades were done (or notified to the exchange), the price of the trade, the volume and the trade type (AT means automatic trade).  GlaxoSmithKline is a highly liquid stock with many willing buyers and sellers. But some stocks are less liquid. In order to enable traders to find a counterparty at short notice, exchanges often require less liquid stocks to have market makers. A market maker places buy and sell orders simultaneously, with a spread between the two prices so that they can profit from each transaction. For instance Diurnal Group PLC has had no trades today and no quotes. It has a more complicated order book, enabling both ordinary buyers and sellers to list if they wish, but market makers are separated out at the top. Here you can see that three market makers are providing liquidity on this stock, Peel Hunt (PEEL), Numis (NUMS) and Winterflood (WINS). They have a very unpalatable spread of over 5% between their bid and offer prices. Further in each case the sum total that they are willing to trade is 3000 shares. If you have more than three thousand Dirunal Group shares to sell, you would have to wait for the market makers to come back with a new quote after you'd sold the first 3000. Based on my research while asking How are unmarketable market orders (other side of the order book is empty) matched with incoming orders? and the one answer there, it seems like there are a few things for certain: All of this of course depends on the exact algorithm specified by the given exchange - I don't think there's a standard here. It's done by Opening Auction (http://www.advfn.com/Help/the-opening-auction-68.html): The Opening Auction Between 07.50 and   a random time between 08.00 and   08.00.30, there will be called an auction period during which time,   limit and market orders are entered   and deleted on the order book. No   order execution takes place during   this period so it is possible that the   order book will become crossed. This   means that some buy and sell orders   may be at the same price and some buy   orders may be at higher prices than   some sell orders. At the end of the random start period,   the order book is frozen temporarily   and an order matching algorithm is   run. This calculates the price at   which the maximum volume of shares in   each security can be traded. All   orders that can be executed at this   price will be filled automatically,   subject to price and priorities. No   additional orders can be added or   deleted until the auction matching   process has been completed. The opening price for each stock will   be either a 'UT' price or, in the   event that there are no transactions   resulting form the auction, then the   first 'AT' trade will be used. 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.  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. I work in a firm that performs this kind of execution for a number of instutional traders. We sell a number of algorithms, and a lot of research goes into building good market signals and forecasts, but the basic idea is that we make a trade-off between time to execute and market impact. This generally means that we're doing a mix of everything you said; we will join the bid for some fraction of our size, and also hit the offer when it looks like the price might be moving away from us. In some certain situations we will even sweep the book several levels deep to avoid tipping off market makers and having them adjust in anticipation of the rest of our order. At any point of time, buyer wants to purchase a stock at lesser price and seller wants to sell the stock at a higher price.  Let's consider this scenario  Company XYZ is trading at 100$, as stated above buyer wants to purchase at lower price and seller at higher price, this information will be available in Market depth, let's consider there are 5 buyers and 5 sellers, below are the details of their orders Buyers List Sellers List Highest order in buyers list will contain the bid price and bid quantity, Lowest order in Sellers list will contain the offer price and offer quantity. Now, if I want to buy 50 Stocks of company XYZ, need to place an order first, it can be either limit or Market. Limit Order : In this order, I will mention the price(buy price) at which I wish to buy, if there is any seller selling the stock less than or equal to price I have mentioned, then the order will be executed else it will be added to buyers list Market Order : In this order, I will not mention the price, if I wish to purchase 50 Stocks, then it will find the lowest offer price and buy stocks, in our case it will be 101. if I wish to purchase 200 Stocks, then it will find the lowest offer price and buy stocks, in our case it will be 2 transactions, since entire request cannot be accommodated in single order Usually the volume(Ask Volume and Offer Volume) being displayed are all Limit orders and not Market orders, Market orders are executed immediately. This is just an example, However several transactions are executed within a second, hence we will get to know the exact value only after the order is completed(executed) Futures exchanges are essentially auction houses facilitating a two-way auction. While they provide a venue for buyers and sellers to come together and transact (be that a physical venue such as a pit at the CME or an electronic network such as Globex), they don't actively seek out or find buyers and sellers to pair them together. The exchanges enable this process through an order book. As a futures trader you may submit one of two types of order to an exchange: Market Order - this is sent to the exchange and is filled immediately by being paired with a limit order.   Limit Order - this is placed on the books of the exchange at the price you specify. If other participants enter opposing market orders at this price, then their market order will be paired with your limit order. In your example, trader B wishes to close his long position. To do this he may enter a market sell order, which will immediately close his position at the lowest possible buy limit price, or he may enter a limit sell order, specifying the price at or above which he is willing to sell. In the case of the limit order, he will only sell and successfully close his position if his order becomes the lowest sell order on the book. All this may be a lot easier to understand by looking at a visual image of an order book such as the one given in the explanation that I have published here: Stop Orders for Futures Finally, not that as far as the exchange is concerned, there is no difference between an order to open and an order to close a position. They're all just 'buy' or 'sell' orders. Whether they cause you to reduce/exit a position or increase/establish a position is relative to the position you currently hold; if you're flat a buy order establishes a new position, if you're short it closes your position and leaves you flat. One broker told me that I have to simply read the ask size and the bid size, seeing what the market makers are offering. This implies that my order would have to match that price exactly, which is unfortunate because options contract spreads can be WIDE. Also, if my planned position size is larger than the best bid/best ask, then I should break up the order, which is also unfortunate because most brokers charge a lot for options orders. It depends on the sequence in which the order [bid and ask] were placed. Please read the below question to understand how the order are matched. How do exchanges match limit orders? "I am not familiar with this broker, but I believe this is what is going on: When entering combination orders (in this case the purchase of stocks and the writing of a call), it does not make sense to set a limit price on the two ""legs"" of the order separately. In that case it may be possible that one order gets executed, but the other not, for example. Instead you can specify the total amount you are willing to pay (net debit) or receive (net credit) per item. For this particular choice of a ""buy and write"" strategy, a net credit does not make sense as JoeTaxpayer has explained. Hence if you would choose this option, the order would never get executed. For some combinations of options it does make sense however. It is perhaps also good to see where the max gain numbers come from. In the first case, the gain would be maximal if the stock rises to the strike of the call or higher. In that case you would be payed out $2,50 * 100 = $250, but you have paid $1,41*100 for the combination, hence this leaves a profit of $109 (disregarding transaction fees). In the other case you would have been paid $1,41 for the position. Hence in that case the total profit would be ($1,41+$2,50)*100 = $391. But as said, such an order would not be executed. By the way, note that in your screenshot the bid is at 0, so writing a call would not earn you anything at all." "You are right, if by ""a lot of time"" you mean a lot of occasions lasting a few milliseconds each. This is one of the oldest arbitrages in the book, and there's plenty of people constantly on the lookout for such situations, hence they are rare and don't last very long. Most of the time the relationship is satisfied to within the accuracy set by the bid-ask spread. What you write as an equality should actually be a set of inequalities.  Continuing with your example, suppose 1 GBP ~ 2 USD, where the market price to buy GBP (the offer) is $2.01 and to sell GBP (the bid) is $1.99.  Suppose further that 1 USD ~ 2 EUR, and the market price to buy USD is EUR2.01 and to sell USD is EUR1.99.  Then converting your GBP to EUR in this way requires selling for USD (receive $1.99), then sell the USD for EUR (receive EUR3.9601).  Going the other way, converting EUR to GBP, it will cost you EUR4.0401 to buy 1 GBP.  Hence, so long as the posted prices for direct conversion are within these bounds, there is no arbitrage." Because in the case for 100/101, if you wanted to placed a limit buy order at top of the bid list you would place it at 101 and get filled straight away. If placing a limit buy order at the top of 91 (for 90/98) you would not get filled but just be placed at the top of the list. You might get filled at a lower price if an ask comes in matching your bid, however you might never get filled. In regards to market orders, with the 100/101 being more liquid, if your market order is larger than the orders at 101, then the remainder of your order should still get filled at only a slightly higher price. In regards to market orders with the 90/98, being less liquid, it is likely that only part of your order gets filled, and any remained either doesn't get filled or gets filled at a much higher price. "I place a trade, a limit order on a thinly traded stock. I want to buy 1000 shares at $10. The current price is $10.50. Someone places a market order for 500 shares. Another trader has a limit order for $10.10 for 400 shares. His order fills, and I get 100 at my price. I wait another day to see if I get any more shares. This is just an example of how it can work. I can place my order as ""all or none"" if I wish to avoid this." But how does the quantity matching happen? For example, if I want to buy 1000 shares at $100, but there is only one seller to sell 10 shares at $100, what happens then? This depends on the type of order you've placed. If you placed a fill-or-kill order, your order to buy or sell a certain number of shares is routed to the trading floor for immediate execution. If the order cannot be immediately filled, it is cancelled (killed) automatically. Note that the order must be filled in its entirety. Partial fills are not allowed. In your example, your buy order wouldn't be filled because it couldn't be matched to a sell order of the same volume. This is similar to an all-or-none order, which is an order that contains  A condition instructing the broker to fill the order completely or not at all. If there is insufficient supply to meet the quantity requested by the order then it is canceled at the close of the market. In this case, if your order wasn't matched to an order of the same volume by the time the market closes, it's cancelled. If you simply placed a market/limit order, and (in the case of the limit order), part of your order was matched to another order with the right price, that part of your order will be filled, while the rest will remained unfilled.