A centralized exchange (CEX) — Binance, HTX, Coinbase, OKX — looks like a simple app with a buy button. Underneath it is four distinct machines: an order book, a matching engine, a custody system, and (for futures) a risk engine. Understanding each one changes how you trade.

The order book: where the price comes from

There is no official price of Bitcoin. At any moment, an exchange holds a list of bids (offers to buy) and asks (offers to sell), sorted by price. The gap between the best bid and best ask is the spread. “The price” you see is simply the last trade that crossed that gap.

You interact with the book through two basic order types:

  • Limit order — “buy at 60,000 or better”. It sits in the book until someone takes it. You control the price, not the timing.
  • Market order — “buy now at whatever is available”. You control the timing, not the price. Large market orders walk through the book, filling at progressively worse prices — that difference is slippage.

The matching engine and maker/taker fees

The matching engine pairs orders by price-time priority: best price first, earliest order first at the same price. Orders that rest in the book make liquidity; orders that execute immediately take it. Exchanges charge takers more than makers — often several times more — because a deep order book is their core product. This is why systematic traders (and trading bots) prefer post-only limit orders: patience is literally paid for.

Custody: what you actually own on an exchange

When you deposit coins, they move into the exchange's omnibus wallets, and your “balance” becomes a row in the exchange's internal database. Trades between users never touch the blockchain — they are database updates, which is why they are instant. Only deposits and withdrawals are real on-chain transactions.

The implication is blunt: an exchange balance is an IOU from a company. If the company is hacked, becomes insolvent, or freezes withdrawals, the IOU is what you hold — FTX made this concrete in 2022. Proof-of-reserves audits help but have limits (they show assets, not liabilities). The practical rules: keep only working capital on exchanges, and long-term holdings in self-custody (see what owning crypto means).

The derivatives machinery

For futures, the exchange also operates a real-time risk system:

  • Margin engine — continuously values every position against the mark price and checks collateral (see how margin works).
  • Liquidation engine — force-closes positions whose collateral falls below maintenance requirements, usually with a penalty fee.
  • Insurance fund — absorbs losses when a liquidation fills worse than the bankruptcy price, so winners still get paid.
  • Auto-deleveraging (ADL) — the last resort: if the insurance fund can't cover a hole, the exchange trims the most profitable opposing positions. Rare, but it means even a winning position carries some system risk in extreme markets.

APIs: how software trades

Every serious exchange exposes an API — the same order types available programmatically over REST and live market data over WebSocket. An API key authorizes software to act on your account, with granular permissions. The one security rule that matters: keys used for trading should have withdrawals disabled. A leaked trade-only key can make bad trades; it cannot move funds off the exchange.

The honest part

An exchange is your counterparty, your custodian, and your infrastructure — all at once. It can go down precisely during the volatility you most need it (overloaded matching engines during crashes are a recurring event across the industry), and its solvency is something you assess on trust and reputation, not proof. None of this makes exchanges avoidable for active trading; it makes sizing your exposure to any single one of them a risk decision like every other.

Why this matters for how you trade

Fees, slippage and funding quietly decide whether an otherwise sound approach makes or loses money — a strategy that looks profitable before costs often isn't after them. The strategies people actually run, and what each one pays in these costs, are covered in crypto trading strategies.