# How is limit order handled right at market opening?

Consider the situation I want to buy shares of a company. Further, consider that the share price was at `x` when the market closed at the end of the day. Now during the market closure, I place a limit order with the value `x`. For simplicity sake, we are only looking at one market. That there several stock exchanges all over the world shall be omitted.

My question is now, what happens when the market opens the next day. there are three scenarios for the new share price `y` I can think of

• `y=x`
• `y<x` or
• `x<y`

From my understanding, my limit order is run/executed in any case since I made a limit order at `x`, and the share price must be a continuous function. The cases `x<y` and `y<x` at the instance of market opening can not occur since that would mean that the value can be arbitrary at market opening.

People try to explain that this is a common occurrence, and the price might drop or skyrocket overnight. I do understand that exceptional circumstances like a server breakdown or a whole company disappearing might cause that. But when all infrastructure works, how can that be?

I am baffled by how this works. Maybe I also need to review how the stock market works. Are there also some material that explains my situation.

## Comment

Thank you all for the hints. I was wrong assuming that `share price must be a continuous function`. I looked to reference up and now I learnt something, I will leave the questions as is so that other can learn from my wrong assumptions.

@RockPaperLz- Mask it or Casket: you are the first one to notice my username. And it checks out. haha

• I asked a similar question at money.stackexchange.com/q/142141/9090 that may have useful answers. Sep 22, 2021 at 4:33
• Well, it's a good question, so you got my upvote, but it was going to be hard to not upvote a reasonably good question by someone with your username. Sep 22, 2021 at 12:34
• It is bugging me that you did 'y=x' and 'y<x' but not 'y>x". Sep 22, 2021 at 18:20
• Stock price is NEVER a continuous function. By definition it is a stepwise function where each step is defined by the most recent actual transaction. If a stock just sold for \$10/share, and the next transaction happens at \$11/share the price does not pass through the individual pennies in the difference. The jump is instantaneous. Sep 22, 2021 at 20:13
• In most cases, there is no single definitive ‘share price’. There are many different prices: those of the latest on-exchange trade, the best bid and offer in the order book and their midpoint, ditto in the quote book, off-book and off-exchange trades, uncrossing trades at the end of an open/close/other auction, or even in a few cases set by an official committee. Data providers must synthesise a headline price from all that data (and they don't always do so in exactly the same way, especially for stocks which are very slow/low-volume/suspended, or while the market's closed). Sep 22, 2021 at 23:09

From my understanding, my limit order is run/executed in any case since I made a limit order at `x`, and the share price must be a continuous function. The cases `x<y` and `y<x` at the instance of market opening can not occur since that would mean that the value can be arbitrary at market opening.

No, share prices do not have to be continuous, and the price could be arbitrary at market opening. If yesterday's closing price was \$10, today's opening price could be \$11 without going through \$10.01, \$10.02, etc. Whether or not a share trades at a particular price depends solely on the willingness of the buyer and seller to trade that share at that particular price. For the matching of limit orders during continuous trading (i.e. not during opening or closing), refer to: How do exchanges match limit orders?

However, during the closing and opening, the matching of limit orders works differently. On most stock exchanges, a single-price auction (call auction) occurs at the opening and at the closing. Example of closing auction session: from 16:45 to 17:00, traders enter their orders, but these orders are not executed; the orders are gathered into an order book. At 17:00 (the closing time), the order book is examined, and the closing price is chosen at the price where the most number of shares will trade. Then, all orders that can execute at that chosen closing price will execute at that closing price. Similarly for the opening auction. There is no requirement for the price to be continuous. There is no reason why the price during a single-price auction must be the same as the price during another single-price auction.

• I'd argue share prices can never be continuous. Sep 22, 2021 at 8:17
• @David in the limit they can be close enough... if a \$100 share is moving in \$0.01 increments, who cares that it's technically not continuous? Sep 23, 2021 at 10:35
• Does this mean that it is relatively safe to enter orders close to open/close for stocks with high volume? I always had the (subjective) feeling that there is a bigger risk for big players trying to "collect" small investor bids during this time...
– AnoE
Sep 23, 2021 at 11:11
• @AnoE Could you explain how this "collecting small investor bids" works? With limit-on-open (LOO) or limit-on-close (LOC) orders, one is able specify the minimum/maximum price that one is willing to pay/receive.
– Flux
Sep 23, 2021 at 12:04
• @Flux: If you are placing market orders on any illiquid security under any circumstances, you should expect to sometimes get a weird price. That's what "illiquid" means. Sep 24, 2021 at 8:46

the share price must be a continuous function

Even if this were true, at least 17.5 hours pass between the close and the next open in US stock markets. The "true" price can change throughout this time. Sometimes the price remains visible, as with after-hours and pre-market trading. Sometimes the price is not quoted but people's views on the stock are still changing, and will suddenly be reflected when trading starts again; other correlated instruments like futures and foreign stocks may be a guide to these changes in the meantime. World events (and their impact on a company's value) don't stop when the stock market is closed.

Price is what a buyer and seller are willing to exchange a stock for at a given time. This willingness changes moment by moment, based on news and sentiment, regardless of how much (if any) actual buying or selling of the stock is happening. Because orders (bids and offers) can be modified or canceled at any time, a stock does not have to trade through all intermediate prices when going up or down.

Price does tend to move in small increments during active trading, simply because the change in news or sentiment during the fraction of a second from one trade to the next is small. But 17.5 hours is a long time. Big professional traders do not typically leave orders open overnight. There is no reason people would be willing to trade at price `x` at 9:30am just because they were willing to trade at price `x` at 4:00pm the previous day.

Some other relevant questions:

The market is an auction and a security's price is determined by supply and demand. If there is a order imbalance (net excess buy or sell volume), overnight price will change. This may occur during after hours trading and if there is none, at the open of regular hours trading.

If you place a limit order at X, you'll be filled at X if the security trades at that price. If the security opens at a higher price, you'll get nothing. If the security opens at a lower price, you're likely to get a fill with price improvement.

• That would imply that `after hours trading` can have immense influence and the function is not continuous. Are their rules to the price improvement at a lower price? Sep 21, 2021 at 22:18
• Price does not have to be continuous. It can gap at any time. The exchanges have all kinds of rules regarding how orders are filled. In the simplest sense, if 1,000 shares are being offered for sale at X and someone buys them, if no one else comes in with additional shares to sell at X then the ask price moves up to the next highest price in the order book. Sep 21, 2021 at 22:32

The idea of a stock having a concrete price at any given moment in time is a description of the stock market, not a fundamental reality.

When you say things like:

From my understanding, my limit order is run/executed in any case since I made a limit order at x, and the share price must be a continuous function. The cases x<y and y<x at the instance of market opening can not occur since that would mean that the value can be arbitrary at market opening.

It sounds like you are thinking of there being an underlying continuous function (of time presumably, but only of time when the market is operating) which determines the price, and trades must happen at that price. It's actually the other way around. Trades happen at whatever price the seller and buyer agree on. That is the underlying reality. In so far as there is a value we can call "the price" at all, we infer it from trades that take place; we do not use "the price" to determine which traders must agree to buy and sell.

Actual trades happen at discrete times for discrete volumes and at discrete prices. When a stock trades at \$10 at 9am and \$11 at 10am, it doesn't really mean that it gradually rose by \$1 over the course of an hour. It just means that at 9am two market actors agreed to trade some of the stock at \$10, and at 10am two (probably different) actors agreed to trade some of the stock at \$11. What was the price at 9:30? There's not really any data on that; at 9:30 no one was willing to sell any stock at any price that anyone was wiling to pay.

Similarly, why would it matter that "the value can be arbitrary at market opening"? Say the stock closed at \$10 and overnight you place a limit order to buy it at \$10. In the morning none of the owners want to sell it for less than \$12. You argue that in order to be regarded as continuous the price "should" start at \$10 and then move from there up to \$12, so your overnight limit order should be fulfilled. But who's selling it at \$10 for you to buy from? If someone else had submitted orders to sell at \$10 overnight, sure, they'll be matched with yours. But such orders are not compelled into existence merely so that the stock price can be a continuous function (of market-open time). To make the price conform to your idea of continuity we would have to force some stock owner to sell at a price they didn't agree to; no one would want to trade on a market that operated this way.

If you want to regard the stock price as a function of time you can, but that is a model we invent to abstractly describe the behaviour of the whole community of buyers and sellers. The actual price at which trades happen isn't a continuous function of time, it's not even a discontinuous function of time because it only has a value at the specific moments when trades happen. We can interpolate between trades to come up with a function of time (and we're sort of doing that any time we compare the price of different stocks at a single point in time, because there's nothing forcing two different stocks to ever have trades that take place at the same moment in time, let alone at the particular moment we want to consider). But we come up with the function from the trades that actually happen, in order to describe the behaviour of the market. We are not discovering some underlying true function that determines the behaviour of the market.

You have a fundamental misunderstanding of how exchanges work.

The "share price" is not the price you can buy or sell at. It is just the price at which the last transaction was executed.

At any point in time, there is a list of people who want to buy those shares, each with a maximum quantity and a maximum price. And there is another list of people who want to sell those shares, each with a maximum quantity and a minimum price. All together, this is the order book.

As soon as there are matching buy and sell orders (someone wants to buy shares at a price that is higher or equal to the price someone wants to sell shares for), a transaction happens. Until that happens, the orders stay on the book until something moves (or the orders expire).

Let's consider that at time of closing the last transaction was at \$100 (so the "share price" is \$100), and that the order book has these lines:

• Sell 100 shares for \$101

• Sell 200 shares for \$102

• Sell 50 shares for \$105

• Buy 90 shares for \$99

• Buy 150 shares for \$98

• Buy 500 shares for \$90

When you place your limit order to buy 10 shares at \$100, the order book becomes:

• Sell 100 shares for \$101

• Sell 200 shares for \$102

• Sell 50 shares for \$105

• Buy 10 shares for \$100

• Buy 90 shares for \$99

• Buy 150 shares for \$98

• Buy 500 shares for \$90

As you can see, there's still no match (no one wants to sell for \$100, they all want at least \$101), so no transaction happens right away. One will happen when either:

• Someone says they want to sell for \$100 (you get your shares)
• Or someone says they want to buy for \$101 (they get the shares from the first order in the list). In that case the new price is \$101, just because that's the price the last transaction was executed.

You order will only get executed once someone says they want to sell for \$100. May happen the next minute, or 3 hours later, or never.

If on the other hand when you placed your order there was already a sell order for \$100 (which is quite possible if the last transaction was at \$100: someone may have had 200 shares to sell at \$100, and only 100 were bought at that price, so there are 100 shares left).

The share price is definitely not "continuous" (which doesn't even make sense for a price which has fixed increments). It usually evolves little at a time, but that's because the spread between buy and sell orders is often relatively small. But it can vary wildly, especially if the order book is quite empty or when important news (good or bad) arrive.

I refer you to this previous answer which has a nice animation showing graphically how the order book works.

• You have a funny way of organizing your order book. I would have put them in descending price order so that the sell and buy would meet/miss in the middle. Sep 24, 2021 at 9:19
• @stackoverblown usually they would rather be shown as two columns, one for buy (decreasing prices) and one for sell (increasing prices), so that any match occurs on the top line. But columns are not easy on SE Sep 24, 2021 at 12:37

IT depends on the order book and which exchange. If it closed at 10 and it looks set to open at 9 your broker should fill it close to that opening price. A NYSE specialist would fill your order at 10 by shorting it and immediately buy it at 9 hoping there won't be a complaint.