What will happen if my order exceeds the bid or ask size? For example, if the bid or ask is 100 shares, but I want to buy 100,000 shares, is it possible to do so?
You should check with your broker.
I asked my broker a similar question just 2 weeks ago.
With their market orders they will be filled within 3 points from the current market bid/ask. If there is any remaining it will be placed as a limit order at 3 points away from the bid/ask price.
For example, if the current ask is 100 @ $1.00 followed by 500 @ $1.01, 300 @ $1.02 and 100 @ $1.03; if you were to place a buy market order for 1000 shares you would get 100 filled at $1.00, 500 filled at $1.01, 300 filled at $1.02 and 100 filled at $1.03.
If, on the other hand, you were to place a buy market order for 2000 shares you would get 100 filled at $1.00, 500 filled at $1.01, 300 filled at $1.02 and 100 filled at $1.03, with the remaining 1000 of your order being placed as a limit order at $1.03.
Again, check with your broker, as they may be different in how they treat their market orders.
This is a great question precisely because the answer is so complicated. It means you're starting to think in detail about how orders actually get filled / executed rather than looking at stock prices as a mythical "the market".
"The market price" is a somewhat deceptive term. The price at which bids and asks last crossed & filled is the price that prints. I.e. that is what you see on a market price data feed.
In reality there is a resting queue of orders at various bids & asks on various exchanges.
(source: Larry Harris. A size of
1H = 100 shares.)
So at first your
1000H order will sweep through the standing queue of fills. Let's say you are trading a low-volume stock. And let's say someone from another brokerage has set a limit order at a ridiculous price. Part of your order may sweep through and part of it get filled at a ridiculously high price. Or maybe either the exchange or your broker / execution mechanism somehow will protect you against the really high fill. (Let's say your broker hired GETCO, who guarantees a certain VWAP.)
Also people change their bids & asks in response to what they see others do. Your
1000H size will likely be marked as a human counterparty by certain players. Other players might see that order differently. (Let's say it was a
100 000H size. Maybe people will decide you must know something and decide they want to go the same direction as you rather than take the opportunity to exit. And maybe some super-fast players will weave in and out of the filling process itself.)
There is more to it because, what if some of the resting asks are on other venues? What if both you and some of the asks match with someone who uses the same broker as you? Not only do exchange rules come into play, but so do national regulations.
tl;dr: You will get filled, with price slippage. If you send in a big buy order, it will sweep through the resting asks but also there are complications.