Beginner6 min read

How the Stock Market Works

In this lesson: You will be able to trace a stock order from your screen to a completed trade and name the firms that handle it along the way.

The Short Answer

The stock market is a network of exchanges and other trading venues where people who want to buy shares are matched with people who want to sell them. You never trade with the company directly. Your broker sends your order to a venue, the venue pairs it with an opposite order, and a clearinghouse makes sure the shares and the cash actually change hands.

It helps to separate two markets. When a company first sells shares to the public, in an initial public offering (IPO), the money goes to the company. That is the primary market. After that, nearly all trading happens in the secondary market, where investors buy from and sell to each other. When you buy shares of an established company, your money goes to the seller, not to the company.

Key term

Exchange and Order Book

An exchange is a regulated marketplace, such as the New York Stock Exchange or Nasdaq, that brings buy and sell orders together in one place. For each stock it keeps an order book: a live list of what buyers are willing to pay and how many shares they want, alongside what sellers are asking and how many shares they offer.

When a buy order and a sell order agree on price, the exchange matches them. Matching generally favors the best price first and, among orders at the same price, the one that arrived first. The price of the most recent match is what you see as the stock's last price. Exchanges are not the only venues: a large share of trades also happens on other regulated systems away from the exchanges, but the matching idea is the same.

Who Sits in the Middle

Several firms stand between you and the person on the other side of your trade.

Your broker is the licensed firm that holds your account, accepts your orders and sends them to a venue. Retail traders cannot send orders to an exchange on their own, so every trade starts here. Brokers have a legal duty called best execution, which means making a reasonable effort to get you a favorable price.

A market maker is a firm that stands ready to buy and sell a stock throughout the day. It posts a price it will pay and a slightly higher price it will sell at, and it earns the small difference across many trades. In doing so it provides liquidity, meaning the ability to buy or sell quickly without moving the price much. In the US, many retail orders are filled by large market makers called wholesalers instead of going straight to an exchange, and some brokers are paid for sending orders there, an arrangement called payment for order flow.

Finally, a clearinghouse steps in after the match to guarantee that both sides deliver what they promised.

Example

A Hypothetical Order, Step by Step

Suppose a hypothetical company, Maple Ridge Foods, has this order book. Sellers: 200 shares offered at $50.05 and 300 shares at $50.10. Buyers: 100 shares wanted at $49.95. Ignore fees for simplicity.

You ask your broker to buy 100 shares at the best price available right now. The cheapest sellers are asking $50.05, and they have 200 shares, enough to fill you. Cost: 100 shares x $50.05 = $5,005.00. The last price now shows $50.05, and 100 shares remain offered at that level.

Now suppose, starting from the original book, you had asked for 300 shares instead. The first 200 come from the $50.05 sellers and the next 100 from the $50.10 sellers. First part: 200 x $50.05 = $10,010.00. Second part: 100 x $50.10 = $5,010.00. Total: $10,010.00 + $5,010.00 = $15,020.00. Average price: $15,020.00 / 300 = about $50.07 per share. The last price is now $50.10. Your own buying used up the cheapest supply and pushed the price higher.

How Prices Move

Nobody sets a stock's price. It moves because orders keep arriving. When more people want to buy than sell at the current price, buyers have to accept higher asking prices, the cheapest sell orders get used up, and the last price rises. When sellers are more eager, they accept lower bids and the price falls.

News, earnings and changes in mood all work through this same mechanism: they change what buyers will pay and what sellers will accept. The order book is simply where those decisions meet.

Key term

Settlement

Settlement is the official transfer of shares to the buyer and cash to the seller. For US stocks, trades settle one business day after the trade date, often written T+1. Your account may show the shares right away, but legally the exchange of shares and cash completes at settlement, handled through the clearinghouse. This timing matters later when you learn how cash and margin accounts treat unsettled money.

Following Your Order

Run through this path whenever you want to picture what happens after you tap buy or sell.

  • You enter an order with your broker, choosing the stock, the number of shares and the order type.
  • Your broker routes it to an exchange, a market maker or another trading venue.
  • The venue matches it with an opposite order, best price first.
  • The match price becomes the stock's latest trade price.
  • A clearinghouse confirms both sides and settles the trade one business day later.

Key takeaways

  • The stock market is a network of venues that match buyers with sellers, and after an IPO your money goes to another investor, not the company.
  • Your broker routes your order, a venue matches it, market makers supply liquidity and a clearinghouse completes the trade.
  • Prices move because buy and sell orders use up the available supply or demand at each price level.
  • US stock trades settle one business day after the trade date.

Check your understanding

4 questions. Sign in to save your progress.

  1. 1.You buy shares of a company that went public years ago, using your broker during normal trading. Who receives the money you pay?
  2. 2.A hypothetical stock's order book shows sellers offering 100 shares at $20.10 and 200 shares at $20.20. You buy 200 shares at the best available prices, ignoring fees. What is your total cost?
  3. 3.What does a market maker do?
  4. 4.You buy shares of a US stock on a Monday that is a normal business day, and Tuesday is also a normal business day. When does the trade settle?

0 of 4 answered

Practice

Try buying shares

In a practice account, place a small buy order for a stock you know and note the price you were filled at, the last price before and after, and when the trade shows as settled.

A practice account uses real prices and no real money.

Create a free account to practice

Glossary

Exchange
A regulated marketplace, such as the New York Stock Exchange or Nasdaq, that matches buy and sell orders.
Order book
A live list of the prices and quantities buyers want to pay and sellers want to receive for a stock.
Market maker
A firm that continuously offers to buy and sell a stock, earning the small difference between its two prices and providing liquidity.
Liquidity
How easily you can buy or sell something quickly without moving its price much.
Settlement
The official transfer of shares to the buyer and cash to the seller, which for US stocks happens one business day after the trade.