How Wall Street Works

How the Stock Market Works: From Your Order to the Exchange

What actually happens between pressing buy and owning a share. The order book, the matching engine, NYSE versus Nasdaq, and why the money leaves your account a day later.

AI-assisted, reviewed and edited by Beth Ruelos. How we use AI

6 min read

You press buy on 200 shares of a 50 dollar stock. The app says filled. The position appears. Somewhere between those two events your order was routed to a venue, matched against a stranger’s resting sell order, printed to a public tape, guaranteed by a clearing house and queued for delivery the following business day. The whole sequence took less time than the screen took to refresh.

A share of stock is a legal claim on a fraction of a company, and the stock market is the machinery that lets millions of strangers swap those claims without ever trusting each other. This guide walks that one order through every stage. It prices each stage that can be priced.

Your broker is a routing decision

The broker is not the market. It holds your account. When an order arrives it makes one choice: which venue gets it.

There are three kinds of destination. A registered exchange such as NYSE or Nasdaq, where the order book is public. A wholesale market maker, a firm that fills retail orders out of its own inventory and pays your broker for the privilege of seeing them. Or a private venue, used mainly by institutions working large positions quietly.

Most U.S. retail stock orders go to wholesalers. Those firms pay for the flow and usually fill the order a fraction of a cent better than the public quote, and that improvement is real money in your pocket, because capturing most of the spread on the other side of its own book is how the wholesaler earns a living. Market makers and liquidity does the arithmetic on that trade.

Wherever it lands, Regulation NMS requires the execution to be at or better than the national best bid and offer, the best displayed price across all U.S. exchanges. That one rule is why a stock cannot trade at 50.01 on one exchange and 50.20 on another at the same instant.

The book your order lands in

Strip away the charts. A stock market is a list, ranked by price and then by the time each order arrived.

Side Price Shares
Ask 50.04 900
Ask 50.02 400
Ask 50.01 300
Bid 49.99 500
Bid 49.98 1,200
Bid 49.95 800

Best bid 49.99, best ask 50.01. The quote is 49.99 by 50.01 and the spread is two cents. Nothing happens until somebody crosses that gap.

Your 200 share market buy takes the cheapest stock available: 200 of the 300 shares offered at 50.01, for 200 x $50.01 = $10,002. Now send 600 shares instead. There are only 300 at 50.01, so the order eats upward, taking 300 x $50.01 = $15,003 and then 300 x $50.02 = $15,006, a total of $30,009 and an average of $30,009 / 600 = $50.015, which is a worse price than the one on your screen even though nobody on the other side did anything to you. You moved your own fill by showing up with size. Traders call that market impact. A quote is a price for a quantity.

Matching is price first, then time

The matching engine pairs orders by price priority, then by time priority. Two bids sitting at 49.99 fill in the order they arrived. That is the entire rule.

It explains the enormous sums trading firms spend on speed, because arriving a microsecond earlier moves you up a queue that pays out in fractions of a cent, millions of times a day.

Once matched, the trade prints to the consolidated tape. That takes seconds. The print is where your app gets the last price, where the chart gets its next tick, and where everyone else learns that 200 shares changed hands.

Clearing nets it, T+1 settles it

The National Securities Clearing Corporation steps between buyer and seller and takes the other side of each leg, so a stranger’s solvency never becomes your problem, and nobody anywhere in the chain checks whether the person selling to you is solvent.

Clearing also nets. A firm that bought 800,000 shares and sold 790,000 shares of the same stock across a day settles a net 10,000 shares, not 1.59 million.

Settlement is the legal transfer of ownership and cash. Since May 2024 the U.S. standard has been T+1, one business day after the trade date. Buy on a Tuesday, settle on Wednesday. Your broker shows the position immediately and lets you trade it. The delivery finishes behind the scenes.

Why the company never sees your money

New shares are created and sold in the primary market, at the IPO or a later offering, and the company receives that cash, minus underwriting fees, exactly once.

Everything after is the secondary market: two investors swapping shares at a price they agree, with the company nowhere in the transaction. Nearly all the volume in the news is secondary.

Which explains something people find strange. A stock can fall 40 percent without the company losing a dollar it already holds. The price is what the last two strangers agreed on. It changes the company’s ability to raise money later and the value of every employee’s stock award. The bank balance stays where it was.

Listing venue barely matters to you either. NYSE runs an auction model with a floor in lower Manhattan and a designated market maker responsible for each listed stock, most visibly at the open and the close. Nasdaq is fully electronic with competing market makers. Trading in either stock happens across many venues at once, and Reg NMS keeps the prices aligned.

Costs, halts and the things that stop the ride

Add up the tolls on that 200 share purchase at 50.01 against a 49.99 by 50.01 quote. Commission, zero. Spread cost against the 50.00 midpoint, 200 x $0.01 = $2.00 going in and $2.00 coming out if you sell at the bid. Regulatory fees on the sale, a fraction of a cent per share. Nothing appears as a line item anywhere.

Round trip that is roughly $4 on a $10,002 position, or 0.04 percent. Do it twenty times a year and the spread alone costs 20 x $4 = $80. In a stock quoted 12.40 by 12.55, the same 200 share round trip costs 200 x $0.15 = $30 against the midpoint, seven and a half times as much, which is why order types are worth an hour of your time before your first trade.

Trading also stops. A single stock pauses when its price moves outside a band in a five minute window under the limit up limit down rules, and the whole market pauses for 15 minutes when the S&P 500 falls 7 percent or 13 percent against the prior close, then closes for the day at 20 percent. Those breakers protect you from the worst prices of a disorderly minute and freeze your position at exactly the moment you want out. Size for that, since you cannot plan around it. The mechanics are in dark pools, HFT and Reg NMS.

For the wider map of who owns all this machinery, read what is Wall Street, and stock market hours for how the same order behaves at 7 a.m. and at 4:30 p.m. The stock market basics quiz tests the mechanics above, and the market breadth tool shows how many stocks were actually involved in a day’s move.

Frequently asked questions

How does the stock market actually work?

Companies sell shares to investors once, in the primary market. After that, investors trade those shares with each other on exchanges and other venues. Your broker sends your order to one of those venues, a matching engine pairs it with an order on the opposite side at an agreed price, and a clearing house guarantees that the shares and cash change hands the next business day.

What is an order book?

An order book is the list of every resting buy and sell order at a venue, sorted by price. Buy orders are called bids and sell orders are called offers or asks. The highest bid and the lowest ask form the current quote, and the gap between them is the spread. A market order is filled against the best prices sitting in that book.

What is the difference between NYSE and Nasdaq?

Both are national U.S. stock exchanges running the same 9:30 to 4:00 Eastern session. NYSE is an auction market with a physical floor and a designated market maker assigned to each listed stock. Nasdaq is entirely electronic with competing market makers. For an individual investor the practical difference is close to nothing, since prices are linked across all venues.

What does T+1 settlement mean?

Settlement is the moment ownership legally transfers and cash moves. Since May 2024 U.S. stocks settle on T+1, meaning one business day after the trade date. A trade made on a Monday settles on Tuesday. The shares appear in your account immediately for trading purposes, but the underlying transfer completes on the settlement date.

Where does my money go when I buy a stock?

To the investor on the other side of the trade, through the clearing system. The company whose ticker you bought receives nothing, because those shares were issued years earlier. The only time a company receives your cash is when it issues new shares in an offering.

Why did my order fill at a different price than I saw?

Quotes change many times a second. If you sent a market order, it takes whatever price is available when it arrives, which may be worse than the price on your screen a moment earlier. Using a limit order fixes the worst price you will accept, at the cost of possibly getting no fill at all.