PnL ProfitEncyclopedia
🌐 English

Market Data

7 min read · Updated Nov 23, 2026
More in Algorithmic & Quant Trading

Market data is the record of prices, quotes, trades and order book activity produced by exchanges and other trading venues. Every algorithmic strategy depends on it twice: historical data for research and backtesting, and live data for trading. The type of data, where it comes from, how it is timestamped and how it is cleaned can change a strategy's measured performance as much as the strategy logic itself.

Key takeaways

  • Tick data records every trade or quote change; bar data summarizes activity into periods such as one minute or one day.
  • Level 1 shows the best bid and ask, Level 2 shows depth at each price, and Level 3 shows individual orders.
  • Historical data must be adjusted for splits, dividends and futures rolls, and should include delisted instruments.
  • Professional data is licensed, and fees depend on who you are and how you use it.
  • Timestamps, time zones and clock synchronization cause many subtle backtest and live-trading errors.
On this page
  1. Tick data vs bar data
  2. Level 1, Level 2 and Level 3
  3. Historical data sources by type
  4. Costs and licensing
  5. Timestamps and clock sync
  6. Cleaning data
  7. Worked example: adjustments
  8. Common mistakes

Tick data vs bar data

Tick data records each individual event: every trade (price, size, time, sometimes the aggressor side) and every quote update (bid and ask price and size). It is the most detailed form of data and is necessary for intraday execution research, order flow analysis and realistic fill simulation. It is also large and harder to store and process.

Bar data summarizes activity into periods. A bar records the open, high, low and close price plus volume (OHLCV) for each interval: one minute, one hour or one day. Bars are compact and sufficient for most swing and position strategies.

Bar type How a bar is formed Notes
Time bars Fixed time intervals Standard, but contain very different amounts of activity at the open versus midday
Tick bars Fixed number of trades More bars when the market is busy
Volume bars Fixed number of shares or contracts Samples by activity
Dollar bars Fixed traded value Adjusts for price changes over long histories

Bars hide information. A daily bar does not tell you whether the high came before the low, so a backtest that assumes a stop and a target were both touched on the same day has to guess which happened first.

Level 1, Level 2 and Level 3

These terms describe how much of the order book a feed shows.

Level Contents Typical uses
Level 1 Best bid and ask (with sizes), last trade, volume Most retail trading, charting, simple bots
Level 2 (market by price) Total size at each of several price levels on each side Depth analysis, execution, short-term strategies
Level 3 (market by order) Every individual order, with additions, changes and cancellations Queue position modelling, market making, research

In US equities, there is also a distinction between consolidated feeds, which combine quotes from all exchanges into a national best bid and offer, and direct proprietary feeds from each exchange, which are faster and more detailed. Crypto exchanges typically offer Level 2 snapshots and incremental updates over WebSocket, and some provide order-level data.

Historical data sources by type

Source type Examples of what they provide Considerations
Exchanges directly Official historical trades, quotes and order book data Most authoritative; often expensive and complex
Commercial data vendors Cleaned multi-asset history, corporate actions, fundamentals Quality and coverage vary; check survivorship handling
Broker and platform APIs Recent bars and ticks for instruments they offer Convenient; history may be limited and broker-specific
Crypto exchange APIs Free trades, bars and sometimes order book snapshots Coverage gaps during outages; each exchange differs
Academic databases Long, survivorship-free histories, such as CRSP for US stocks and TAQ for US trades and quotes Usually accessed through universities
Free websites Daily bars for major assets Fine for learning; check adjustments, gaps and delisted names

For stock research, look for survivorship-free data that includes delisted companies and point-in-time index membership. For fundamentals, use point-in-time data that shows what was known on each date, not later restatements.

Forex has no central exchange, so "volume" in retail forex data usually reflects only one broker's or one platform's activity. In crypto, reported volume on some venues has historically included wash trading, so compare across sources. See volume analysis.

Costs and licensing

Market data is a significant business for exchanges. Key points:

  • Subscriber classification. Many exchanges charge individual non-professional users much less than professional users. Definitions vary and can depend on whether you are registered with a regulator or trade for others.
  • Display vs non-display use. Exchanges often charge separately for data used by automated systems (non-display) as opposed to data shown on a screen.
  • Redistribution. Most licenses forbid passing data on to others, including publishing it on a website or reselling signals derived directly from it.
  • Delayed data. Data delayed by around 15 minutes is often free or cheap, but useless for live trading.

Fee schedules change, so check the current terms of your broker, vendor or exchange.

Timestamps and clock sync

Time is one of the most common sources of error.

  • Which timestamp? A trade can carry the exchange's matching time, the time the data was published, and the time your system received it. For backtests, signals should only use data as of the time you would have received it.
  • Time zones and daylight saving time. Store everything in UTC. Daylight saving changes shift local session times relative to UTC on different dates in different countries, which can misalign data from multiple markets.
  • Daily bar definitions. Forex and crypto trade around the clock, so the "daily close" depends on the provider's chosen cut-off time.
  • Clock synchronization. Live systems synchronize their clocks using NTP, which is typically accurate to within milliseconds over the internet, or PTP, which can reach microseconds on suitable networks. Regulators in some regions set clock accuracy requirements for trading firms, with the strictest tolerances for high-frequency traders. Unsynchronized clocks can also cause exchange APIs to reject signed requests, as noted in building trading bots.

Cleaning data

Before using any dataset, check for:

  • Bad ticks: prints far from surrounding prices, often from errors or unusual trade types.
  • Missing data and gaps: exchange outages, holidays, halted trading.
  • Duplicates and out-of-order records.
  • Corporate actions: splits, reverse splits, dividends, spin-offs and symbol changes.
  • Futures rolls: continuous contracts stitched from expiring contracts need consistent adjustment.
  • Zero or negative prices: usually errors, though some instruments, such as WTI crude futures in April 2020, have genuinely traded below zero.

Filters should be documented and applied the same way to research and live data.

Worked example: adjustments

A stock split

A stock trades at 600 dollars and then splits 4-for-1, so each share becomes four shares and the price becomes about 150 dollars. In unadjusted data, the series appears to drop 75% overnight. A backtest would treat this as a crash, firing stop-losses and mean-reversion buy signals that never existed.

Split-adjusted data divides all prices before the split by 4 (and multiplies volumes by 4), so the pre-split 600 becomes 150 and the series is continuous.

A futures roll

A trader builds a continuous series from quarterly futures. On the roll date, the expiring contract trades at 4,000 and the next contract at 4,020. Splicing them without adjustment creates a fake 20-point jump. A back-adjusted series adds 20 points to every earlier price, removing the jump. Ratio adjustment, which multiplies earlier prices by 4,020 / 4,000 = 1.005, is an alternative that preserves percentage returns.

Data volume

One-minute bars for a single US stock during regular hours (390 minutes a day) over 252 trading days produce 390 × 252 = 98,280 bars a year, which is easy to store. Tick and quote data for the same stock can run to millions of records per day for heavily traded names, which is why tick-level research needs proper storage and tooling.

Common mistakes

  • Using unadjusted prices for stock backtests.
  • Using only currently listed symbols, which builds survivorship bias into results.
  • Mixing time zones between data sources.
  • Assuming the daily close is universal in 24-hour markets.
  • Backtesting with bar data on strategies that need tick-level fills.
  • Ignoring licensing terms when sharing or publishing data.

FAQ

What is the difference between Level 1 and Level 2 data?

Level 1 shows only the best bid, best ask and last trade. Level 2 shows the quantity available at several price levels on each side of the order book, giving a view of market depth.

Where can I get historical market data?

Sources include exchanges, commercial data vendors, broker and platform APIs, crypto exchange APIs and academic databases. Free sources are fine for learning, but check them for adjustments, gaps and survivorship bias before relying on them.

Do I need tick data for backtesting?

Not for most daily or swing strategies, where clean bar data is sufficient. Tick or quote data matters for intraday strategies, realistic modelling of fills and slippage, and anything that depends on the order book.

Why is market data so expensive?

Exchanges and vendors charge for collecting, distributing and licensing data, and professional and automated uses typically cost more. Individual non-professional users can often get real-time data much more cheaply through their broker.

Educational content only. Nothing here is financial, investment, legal or tax advice. Trading carries a high risk of loss, and leveraged products can lose more than you deposit. Rules, fees and platform details change: check current terms with your broker, exchange or regulator before you trade.