# How are stock prices determined in the following cases?

I looked at this question already. I know there is an order book with bid and ask and that the price is updated when a match occurs. But I have two questions:

1. What happens when the bid is higher than the ask? For example someone is ready to pay \$101 per share for 100 shares and someone wants to sell 100 shares at \$100. What will be the new price?

2. What if there are multiple matches at an instance? Let's say we have someone wanting to buy 100 shares at \$100 and someone wanting to sell 100 shares at \$100. We also have someone wanting to buy 500 shares at $110 and someone wanting to sell 500 shares \$110. What is the new price?

• "we have someone wanting to buy 100 shares at \$100 and someone wanting to sell 100 shares at \$100. We also have someone wanting to buy 500 shares at \$110 and someone wanting to sell 500 shares \$110." Who came first? Each of these offers should have a timestamp, and possible deals are - to my knowledge - resolved immediately. Aug 10, 2022 at 9:29
• What if they have the same timestamp? Given the amount of trades done each day and the low precision of computer clocks, this must have happened before Aug 10, 2022 at 9:59
• @timtam: what do you mean by "when demand is higher than offer"? Asking because the two cases you refer to have the same amounts on both the sellers' and buyers' sides? Your actual questions seem to be different. Should we answer the question in the header or the two unrelated cases in the body?
– BrsG
Aug 10, 2022 at 10:34
• You're right, high demand is being ready to pay a lot, while high offer would be being ready to sell at cheap. So maybe the question is actually what would happen when both demand and offer is high, but when there is a gap as in my first subquestion. Aug 10, 2022 at 11:26
• I am basically just interested in an answer for my two subquestions, the title question is irrelevant Aug 10, 2022 at 11:27

As in the answer here (which you referred to yourself), the price of a stock is the price the stock was last traded at (until that price is updated because a new trade happens). A trade occurs if a bid and ask are matched.

The matching relies on a double ordering. The principle to remember here is "buy low, sell high". Also, remember that the ask is the minimum price a would-be seller is happy to sell, while the bid is the maximum price a would-be buyer is happy to buy. The buy and sell offers are ordered in the following way:

• Asks: lowest first, highest last, then in the order they were submitted.
• Bids: highest first, lowest last, then in the order in which they were submitted.

This is called price-time-priority matching (see here). Many exchanges use a variant of that procedure with potentially some extensions. An important exception is the NYSE, which has a pro-rate system on top (see here), but this is not relevant for your cases.

What happens when the bid is higher than the ask? For example, someone is ready to pay \$101 per share for 100 shares, and someone wants to sell 100 shares at \$100. What will be the new price?

The matching in this case depends on the order in which instructions were submitted and on the best price rule, which says that whoever submits last gets the best available price. One motivation for that rule is that agents shouldn't be punished for submitting limit orders. After all, if that principle were not in place, agents who act last could instead put in market orders (without a limit), where a buyer immidiately buys at the lowest ask, and a seller sells at the highest bid, which may result in a better deal for the agent last to act. If not in place, you wouldn't get many limit orders, if any at all. So this rule favors market liquidity.

Applying these rules, if the sell offer at \$100 was there first, the buyer, even though she is happy to pay \$101, will only pay 100. Conversely, if the buyer places the order first, the seller will sell for 101. So, depending on the order of submission, the resulting price will be either 100 or 101.

What if there are multiple matches at an instance? Let's say we have someone wanting to buy 100 shares at \$100 and someone wanting to sell 100 shares at$100. We also have someone wanting to buy 500 shares at \$110 and someone wanting to sell 500 shares \$110. What is the new price?

Again, the matching depends on the double ordering mentioned above and the best price principle. I won't go through all possible cases, but provide a few illustrations:

• Bid = 500@\$110. The seller comes in with 100@\$100. The trade is executed at the best price (for the seller) at \$110. (if they submit in the reverse order, the trade will happen at a price of \$100)

• Bid = 100@\$100, Ask = 500@\$110. There is no match. Ask = 100@\$100 comes in, "jumps the queue," and 100 shares are traded at \$100.

• Bid = 100@\$100, Ask = 500@\$110. There is no match. A new bid comes in with 500@\$110. It jumps the bid queue and is matched with the ask, and the trade happens at a price of \$100.

Note that time-stamping these days is very accurate, to within one millisecond (see for example here). For any confusion to occur, orders would have the share the same time-stamp and precisely the same price.

• Thanks, very good answer! Is there a name (and possibly a reason) for this principle that the price will be in favor of the last person to make an order? Aug 11, 2022 at 7:15