You tap "Buy." What happens in the next millisecond?
The story so far The bike chain's IPO is done (Lesson 16.1), and its stock now trades every day at about $26. You want 100 shares. You tap "Buy" in your brokerage app (Lesson 5.4), and less than a second later you own them. Who sold them to you? Why did you pay $26.00 and not $25.95? And why does a big fund buying 1,000 shares pay more per share than you? This lesson opens up the machine.
Trading is buying and selling stocks and other securities that already exist. Exchanges and market makers match buyers with sellers.
Every investment you make passes through this machine. Knowing it helps you pay less, avoid traps and answer trading questions in interviews.
Orders wait in an order book. A matching engine pairs buyers and sellers by price, then by time. Market makers fill the gaps.
Traders at banks and funds place big orders. Market makers quote prices all day. Exchange engineers run the matching engines. Compliance officers watch for cheating.
What you're looking at: the path of your order. Your phone sends it to your broker. The broker sends it to a stock exchange or to a market maker (both green), where it's matched with someone selling. The whole trip usually takes less than a thousandth of a second.
Every buyer needs a seller.
In Lesson 5.5 you placed your first order and met the bid, the ask and the spread. Now look inside: where those prices come from, who's on the other side, and who gets paid.
The order book
An exchange like the New York Stock Exchange or Nasdaq keeps an order book for each stock: every limit order still waiting, sorted by price. The highest price a buyer will pay is the bid; the lowest price a seller will take is the ask; the gap is the spread.
- Sellers waiting
- 300 shares at $26.00, 500 at $26.05, 800 at $26.10, 1,000 at $26.20.
- Buyers waiting
- 400 shares at $25.95, 600 at $25.90, 900 at $25.80.
- Spread
- Best ask $26.00 − best bid $25.95 = 5 cents.
The matching engine
A computer called the matching engine pairs orders. It follows price-time priority: the best price goes first, and at the same price, whoever got in line first goes first. A market order takes the best price waiting; a limit order that can't trade yet joins the book.
- Your market order for 100 shares
- Matches the cheapest seller: 100 shares at $26.00. Cost: 100 × $26.00 = $2,600.
- A limit order to buy at $25.97
- No seller is that low, so it waits in the book and becomes the new best bid.
Liquidity and price impact
Liquidity is how easily you can trade without moving the price. A big order eats through the cheapest sellers and then has to pay more. That extra is price impact, also called slippage. Slide the order size to see it.
- A fund buys 1,000 shares at market
- 300 × $26.00 + 500 × $26.05 + 200 × $26.10 = $7,800 + $13,025 + $5,220 = $26,045.
- Average price
- $26,0451,000 = $26.045, so $45 more than if all 1,000 had cost $26.00.
What you're looking at: the order book for the chain's stock. Orange bars are sellers waiting at each price; green bars are buyers. The darker orange part is what your market order buys, starting at the cheapest price and moving up.
Market makers
What if no seller is waiting when you want to buy? A market maker always posts both a bid and an ask, so there's always someone to trade with. It earns the spread, a few cents a share, millions of times a day, and takes the risk that the price moves while it holds shares.
- One round trip
- The market maker buys at $25.95 and sells at $26.00: 5 cents a share.
- A whole day
- 1 million shares × $0.05 = $50,000, if prices hold still.
Who pays for "free" trading?
Most U.S. apps charge no commission. Many make money from payment for order flow: market makers like Citadel Securities pay the broker to send them customer orders, because small orders are easy to profit from. Critics say it can give you a slightly worse price; supporters say customers still often get a price a bit better than the best ask. Big firms also use high-frequency trading: computers trading in millionths of a second.
Selling short
You can also bet a price will fall. In short selling, you borrow shares, sell them now, and buy them back later to return them. If the price falls, you keep the difference. If it rises, you lose, and since a price can rise without limit, so can your loss.
- Short 100 shares at $26
- You get 100 × $26 = $2,600 now.
- Price falls to $20
- Buy back for $2,000: profit $2,600 − $2,000 = $600.
- Price rises to $35
- Buy back for $3,500: loss $3,500 − $2,600 = $900.
Settlement
The trade happens in a millisecond, but the official swap of money and shares, settlement (Lesson 5.5), takes a little longer. Since May 2024, U.S. stocks settle on T+1: one business day after the trade.
- You buy on Monday
- The shares and money officially change hands on Tuesday.
Two minutes. Just listen.
Tap any line to jump to it.
Trading desk.
Eight calls a junior trader makes every day. Each one gives you the numbers. One try each.
What you're looking at: made-up stocks and orders. Each lists the numbers, then asks one question.
The logic, step by step.
Every order goes through the same four steps.
Step 1: You choose the order type
- You
- A market order for 100 shares.
Step 2: Your broker routes it
- Your app
- Sends it to a market maker that pays for the order flow.
Step 3: It's matched
- The match
- 100 shares at $26.00.
Step 4: It settles
- Bought Monday
- Settles Tuesday.
Worked example: buying a big order without overpaying
You're a trader at a fund that wants 2,500 shares of the chain's stock. Here are the facts:
- The order book: 300 at $26.00, 500 at $26.05, 800 at $26.10, 1,000 at $26.20.
- All at once, at market: average $26.114, or $285 more than $26.00 a share.
- The stock trades: about 1 million shares a day.
- See the cost. One market order eats every seller up to $26.20. Slippage: $285.
- Split it up. Buy 300 now at $26.00, then wait for new sellers to arrive.
- Use limit orders. Place the rest at $26.00 or $26.05 so you never pay more than you choose.
- Hide your size. If the market sees a huge buyer, sellers raise their prices. Traders spread big orders over hours or use computer programs to slice them.
- The answer. In a stock that trades 1 million shares a day, 2,500 shares is small. Spread it over an hour with limit orders, and you'll likely pay close to $26.00 instead of $26.114.
The reef's market maker: the cleaner wrasse.
On coral reefs, a small fish called the cleaner wrasse runs a "cleaning station." All day, bigger fish line up to have parasites picked off. One wrasse can serve over 2,000 visitors a day, each paying a tiny "fee" in parasites eaten. Scientists found that wrasses even serve choosy visitors who could go to another station before regulars, to keep their business.
What you're looking at: an illustration, not data. A small striped cleaner wrasse at its station near the coral, with bigger fish lined up for their turn.
Why this sticks. A market maker is a cleaner wrasse: always open, serving a long line of customers, earning a tiny fee from each one. Tiny fees times thousands of visits a day add up to a living.
The page you'd copy down.
- Order book: every waiting buy and sell order. Spread = best ask − best bid: $26.00 − $25.95 = 5 cents.
- Matching engine: price-time priority, best price first, then first in line.
- Liquidity: trading without moving the price. Price impact: 1,000 shares averaged $26.045, $45 extra.
- Market maker: always quotes a bid and an ask, earns the spread: 1 million shares × $0.05 = $50,000.
- Payment for order flow: how many zero-commission apps get paid. High-frequency trading: computers, millionths of a second.
- Short selling: borrow, sell, buy back. $26 → $20: +$600; $26 → $35: −$900. Losses have no limit.
- T+1: U.S. stocks settle one business day after the trade.
Fill in the blanks
Grab a friend or a study group.
Paper order book
Half the group writes buy prices on sticky notes, half writes sell prices. Sort them on a wall into an order book. Where's the spread? Who trades first?
Be the market maker
One person quotes a bid and an ask for a snack. Everyone else can buy or sell one. After ten trades, did the market maker make money?
Spot the spread
Look up the bid and ask for a giant company like Apple and a tiny one. Compare the spreads. Which is more liquid?
Just you and your money.
These stay on this device. Nobody else sees them.
Exam-style questions.
Written the way a college exam would ask them. Each right answer on the first try is worth 10 xp.
On the job: you're a junior trader at a market maker
You make markets in the bike chain's stock. Your manager wants a report on today. Here's the situation:
- Your quote all day: buy at $25.95, sell at $26.00.
- Shares traded with you: 400,000 bought from customers and 400,000 sold to customers.
- At the close: you're left holding 5,000 extra shares you bought at $25.95, and the stock ends the day at $25.80.
- Payment for order flow: you paid brokers $0.002 a share on 800,000 shares.
Your task: what did you earn from the spread? What did the leftover shares cost you? What did you pay brokers? What's your profit for the day, and what's the lesson for tomorrow?
See a model answer
Spread: 400,000 round trips × $0.05 = $20,000.
Leftover shares: 5,000 × ($25.95 − $25.80) = 5,000 × $0.15 = $750 lost.
Order flow: 800,000 × $0.002 = $1,600.
Profit: $20,000 − $750 − $1,600 = $17,650.
For tomorrow: the spread is the business; the risk is holding shares when the price moves. When we pile up extra shares in a falling stock, we should lower our quotes to sell them off sooner.
Every price is a meeting.
What you're looking at: a map of where this lesson fits in the course. Read it left to right: the lessons it builds on, this lesson in the middle, and the lesson that comes next.
- Back · Unit 5Buying your first stock
- Back · Unit 1Supply and demand
- Back · Unit 16Who does what on Wall Street
- You are hereHow trading works
- Next · Unit 16Options and futures