How Trades Work

What actually happens when you press Buy

Every price on a stock app is the edge of a queue: people waiting to buy below it, people waiting to sell above it. Below is a working market, made of simulated traders, running right now. You can trade in it.

Blue rows are people waiting to buy, red rows are people waiting to sell. Press Buy and watch which row your order eats.

A guide for people who never quite got it

Most explanations of investing start with advice. This one starts with the machine. Once you can see how an order becomes a trade, who is on the other side of it, and why the price moves, the advice makes sense on its own, and so do the sales pitches you should ignore.

Each chapter has something to play with. The market is a simulation built for this site: real rules (an order book with price-time priority, market makers, informed and uninformed traders), invented company. Near the end you build a trading bot, test it, and find out why most of them lose money.

Chapters

  1. 1What you are actually buyingA share is a slice of a business. Where its value comes from, and how investing differs from trading.
  2. 2The order bookEvery price you see is the edge of a queue of buyers and sellers. Place orders into a live one.
  3. 3How orders matchMarket, limit and stop orders, price-time priority, partial fills, and what a matching engine actually does.
  4. 4Market makersThe people quoting both sides. Run a market-making desk and learn why the spread exists.
  5. 5From your tap to the exchangeBrokers, routing, payment for order flow, the NBBO, clearing and settlement: the path of one order.
  6. 6Why prices moveNews, informed traders and liquidity. Shock a simulated market and watch it find a new price.
  7. 7Leverage, shorting and riskBorrowed money, betting against a stock, margin calls, and why volatility quietly eats returns.
  8. 8Build a trading botWrite a strategy, run it against a simulated market with real slippage, and read the results honestly.
  9. 9Why most bots loseBacktests lie. Watch a strategy that looked brilliant fall apart on data it has not seen.
  10. 10Investing, for realWhat all of this means for your own money: costs, diversification, time and index funds.