Zero to Unicornby Rupesh Koirala

Ridge 3 · Investing · Day 41 of 65

How trading works

What happens between pressing Buy and owning a share. Brokers, order books, order types, the hidden cost of every trade, and how margin and short selling work.

Today you will

  • Trace an order from your screen to settlement
  • Read a bid, an ask and a spread, and choose the right order type
  • Calculate the full cost of trading, beyond commission
  • Explain margin and short selling and why both can lose more than you put in

The last five days treated markets as places where prices are set. The final stage of the course goes inside the machinery. Today covers how a trade happens. The next two days cover trading as an activity and the instruments that add leverage. Then the course turns to other assets and, on the last day, to your own money.

Even if you only ever buy an index fund once a month, you will do it through this machinery, and knowing how it works will save you money.

From click to ownership

The life of an order

  1. YouEnter an order in a broker's app.
  2. BrokerChecks your account and routes the order.
  3. VenueAn exchange or a trading firm matches you with a seller.
  4. ClearingA central clearing house guarantees both sides of the trade.
  5. SettlementOne business day later, cash and shares change hands.

A broker is the firm that holds your account and has access to the market. You cannot trade on an exchange yourself. The broker also keeps your shares, usually registered in its own name on your behalf. In the United States an industry fund protects customers for up to $500,000 if a broker fails and assets are missing. That protection covers the failure of the firm. It does not cover a fall in the value of what you bought.

Settlement in the United States has taken one business day since May 2024. Until it happens, the clearing house stands between buyer and seller and requires brokers to post collateral against unsettled trades. Today's case study turns on that detail.

The order book

At any moment there are people willing to buy a share at various prices and people willing to sell at various higher prices. The list is the order book.

Buyers (bids) Sellers (asks)
300 shares $49.98 $50.02 200 shares
500 shares $49.97 $50.03 400 shares
800 shares $49.95 $50.05 900 shares

The highest price anyone will pay, $49.98, is the bid. The lowest price anyone will accept, $50.02, is the ask. The gap between them, four cents here, is the spread.

If you want to buy immediately, you pay the ask. If you want to sell immediately, you receive the bid. Buy and then sell at once, with no change in the market, and you have lost four cents a share. The spread is the price of being in a hurry, and it is a cost on every trade whether or not there is a commission.

The amount available at each price is the book's depth. An order for 1,000 shares in the book above would take all 200 at $50.02, all 400 at $50.03 and 400 more at $50.05, paying more with each step. That worsening is called slippage.

Liquidity is the word for how easily something can be traded without moving its price. The largest companies trade with spreads of a cent and deep books. Small companies, most options and anything outside normal hours can have spreads of several percent.

Order types

Order What it says Risk
Market Buy or sell now at the best available price You do not control the price. Dangerous in thin markets.
Limit Buy at this price or lower, or sell at this price or higher It may never be filled.
Stop If the price falls to this level, sell at market In a fast fall it can execute far below the level you set.
Stop-limit If the price reaches this level, place a limit order It may not execute at all in a fast fall.

For most people most of the time, a limit order is the safer habit. It costs nothing and it puts a ceiling on what you pay. Market orders are fine for very liquid shares and funds during normal hours. Avoid them outside those hours, when a single order can move the price.

Who is on the other side

Every purchase has a seller. It helps to know who it might be.

  • Market makers are firms that stand ready to buy and sell all day, earning the spread. They are why you can trade instantly.
  • High-frequency firms trade by computer in millionths of a second, many of them as market makers.
  • Institutions such as pension funds and index funds move very large amounts slowly.
  • Other individuals.

In the United States, most orders from individuals never reach an exchange. Brokers sell them to large trading firms, which fill them from their own inventory and pay the broker for the privilege. This is called payment for order flow, and it is how commission-free trading is funded. Supporters note that individuals often receive a slightly better price than the public quote. Critics note that the broker is being paid by someone other than its customer. Either way, when a service is free, it is worth asking who is paying.

What a trade really costs

There are four costs, and the visible one is now the smallest.

  1. Commission. Often zero for shares in the United States.
  2. The spread. Paid on every round trip.
  3. Slippage. The extra you pay when your order moves the price or the market moves before you are filled.
  4. Tax. In the United States, profits on anything held for a year or less are taxed as ordinary income, which for a well-paid engineer can mean a third or more. Profits on assets held longer are taxed at lower rates.

Today's lab adds up the first three. With its defaults, 200 shares of a $50 stock with a four-cent spread, each round trip costs about $12, or 0.12% of the position. That is tiny. Now make it 100 round trips a year on a $25,000 account: $1,200, or 4.8% of the account. You would have to beat the market by nearly five points, before tax, to match what you would have earned by doing nothing.

Costs scale with activity. This arithmetic, more than any lack of skill, is why frequent traders as a group do worse than patient ones.

Trading hours and halts

American stock exchanges are open from 9:30 in the morning to 4:00 in the afternoon, New York time, on weekdays. Trading before and after those hours is possible and thin: spreads widen and prices jump.

If the S&P 500 falls 7% in a day, trading across the market pauses for fifteen minutes, and again at 13%. At 20% it stops for the day. Individual shares are also paused when they move too fast. These circuit breakers exist to interrupt panics.

Margin: borrowing to trade

A margin account lets you borrow from your broker, using your shares as collateral. In the United States you can typically borrow up to half the purchase price.

Suppose you put in $10,000 and borrow $10,000 to buy $20,000 of shares.

Shares move Position worth Loan Your equity Your return
+20% $24,000 $10,000 $14,000 +40%
-20% $16,000 $10,000 $6,000 -40%
-40% $12,000 $10,000 $2,000 -80%
-50% $10,000 $10,000 $0 -100%

Brokers require your equity to stay above a set share of the position, commonly 25% to 30%. Fall below it and you receive a margin call: add cash at once, or the broker sells your shares, at whatever the price is, without asking. That forced sale happens at exactly the moment prices are lowest. It converts a temporary fall into a permanent loss, the outcome day 40 warned about.

You also pay interest on the loan, which raises the return you need just to stay level.

Short selling

To profit from a fall, a trader can sell shares they do not own. They borrow the shares from a broker, sell them, and hope to buy them back later for less and return them.

The arithmetic is the mirror image of buying, with one crucial difference. When you buy a share, the most you can lose is what you paid, and your gain is unlimited. When you short one, the most you can gain is the sale price, and your loss is unlimited, since there is no ceiling on how high a price can go. Short sellers also pay a fee to borrow the shares and must post margin.

When a heavily shorted share starts rising, short sellers are forced to buy it back to limit their losses. Their buying pushes the price higher, which forces more of them to buy. This is a short squeeze.

Short selling has a useful role. Short sellers were among the first to question Enron's accounts. For an individual, it combines unlimited risk with a market that rises over time.

Lab · 10 min

Playground

This playground needs JavaScript.

Try these

Founder’s call · 5 min

First orders

You want to buy 500 shares of a small company. Its shares trade only a few thousand times a day. The bid is $9.80 and the ask is $10.20.

Quiz · 5 min

Check your understanding

Workbook · 30 min

Trace a trade

Look at how your own orders are, or would be, handled.

Saved in this browser as you type. Everything you write is collected in your workbook.

Key terms

Broker
A firm that executes trades for customers and holds their investments.
Bid-ask spread
The gap between the highest price a buyer will pay and the lowest price a seller will accept.
Market order
An instruction to trade immediately at the best available price.
Limit order
An instruction to trade only at a stated price or better.
Liquidity
The ease with which an asset can be bought or sold without moving its price.
Market maker
A firm that continuously offers to buy and sell a security, earning the spread.
Margin
Money borrowed from a broker to buy securities, secured on the securities themselves.
Short selling
Selling borrowed shares in the hope of buying them back later at a lower price.