Academy/Foundations/Market Structure & Order Types
FoundationsLesson 2

Market Structure & Order Types

Understand how markets work, the types of orders you can place, and how your algorithms interact with other market participants.

10 minute read
4 key takeaways

How Markets Work

At the core of any market is a simple concept: someone wants to buy, someone wants to sell, and they meet at an agreed price. But the mechanics of how this happens are crucial for algorithm design.

The Limit Order Book

The limit order book is the central electronic system that matches buyers and sellers. On the buy (bid) side, you see offers from people willing to buy at various prices. On the sell (ask) side, you see offers from people willing to sell. The spread between the highest bid and lowest ask is called the bid-ask spread—this is the cost of trading.

Order Types: Your Tools

Order TypeExecutionWhen to UseTradeoffs
MarketInstant execution at best available priceWhen speed matters more than priceMay execute at worse price than expected (slippage)
LimitExecute only at your specified price or betterWhen price matters more than speedMay not fill if price is hit only briefly
Stop (Stop-Loss)Triggers when price hits level, then sends market orderAutomatic risk protectionCan be gapped past (gaps in price)
Stop-LimitTriggers at price, then sends limit orderMore control than stop orderMay miss execution completely

Time-in-Force Rules

  • GTC (Good Till Cancelled): Order stays active until filled or manually cancelled
  • GTD (Good Till Date): Order stays active until a specific date
  • DAY: Order only valid for today (cancelled at market close)
  • IOC (Immediate or Cancel): Fill what you can now, cancel the rest
  • FOK (Fill or Kill): Execute entire order immediately or cancel (no partial fills)

Market Participants

  • Retail traders: Individual traders like you (small orders)
  • Institutional investors: Hedge funds, mutual funds, pensions (large orders)
  • Market makers: Firms that quote both bid and ask, profit from spread
  • High-frequency traders (HFT): Very fast algorithms trading microsecond timescales

The Spread is Always a Cost

Every time you trade, you either pay the spread (market orders) or risk not filling (limit orders). Your algorithm's profitability must overcome this cost. Typically, expect spreads of $0.01-$0.05 per share on liquid stocks.

Key Takeaways
  • Markets are driven by a continuous auction between buyers and sellers
  • The bid-ask spread is the cost of instant execution
  • Different order types offer different guarantees and tradeoffs
  • Understanding time-in-force rules is critical for algorithm design