Aperiodic/Markets from First Principles
Markets from First Principles/Part 3, Today's markets

Lesson 10 of 10

Behind the numbers

Why is market data so hard to get right, and how does bad data make a backtest lie?

DMBy Daniel and Mark
6 min

So far: Cost, Depth and Impact are three numbers you can read off any market's book, and the same three compare venues, coins and stock perpetuals (lesson 9).

Every real number in this guide was worked out from records of trades and quotes. A backtest does the same for a strategy: it replays the records and adds up what the strategy would have made. If the records hold something you couldn't have known at the time, or miss something that happened, the backtest is wrong. Some of those faults make a strategy look better than it would have done.

A backtest on bad data

Here is a toy strategy on six toy coins over four months. Every midnight it buys the two coins that rose most the day before, and sells them at the next midnight. If one falls 8% below what it paid, it sells that one at once, with a stop.

The grey line is its money on point-in-time data. Put a fault into the data and run it again: the orange line is what the backtest reports.

Step 1 of 1

Tick one fault at a time and run the backtest. Compare the orange line, what the faulty data reports, with the grey one.

  • coin 1
  • coin 2
  • coin 3
  • coin 4
  • coin 5
  • coin 6delisted
6080100120day 1day 30day 60day 90
Faults in your data

Not run yet. Tick the faults to put into the data, then run the backtest. With none ticked, both runs see the same data.

On point-in-time data the strategy loses 11% over the four months. Each fault on its own turns that loss into a gain, and with all three the backtest reports a gain of 53%. The strategy is the same in every run. Only what the backtest knew has changed.

Three ways data goes wrong

A close that is an hour late gives the signal the first hour of the day it trades. The coins that rose most “yesterday” are partly the coins rising right now, and the backtest buys them at the midnight price, from before that hour. It even sees coin 6 open 45% down after its delisting news, in time to skip it. This is look-ahead bias, and any input stamped earlier than you could have had it does the same.

A recorder that falls behind when trading is busiest drops trades, and the busiest minutes are often the sharpest moves. In the toy, five of them set off the stop on a coin the strategy held, and each time the coin ended the day above its stop. Without those minutes in the data, the backtest never sells, and books the recovery. In real life the stop sold, 8% down.

A list of coins made today holds only the coins that survived. Coin 6 jumped, then collapsed when its delisting was announced in the third month, and it is not on today's list. So the backtest never bought it the night before the crash, and never took the loss. This is survivorship bias.

How busy a busy minute is

The minute of bitcoin trades from lesson 3, from 14:38 UTC on 11 June 2025, held 11,692 trades on Binance's perpetual, about 195 a second. A record that is right has every one of them, in order, each stamped with the moment it could first have been seen. Aperiodic records both the exchange's timestamp and the moment each trade reached its collectors, and can build every bar on either clock. On the arrival clock, a bar holds only what had reached the collectors by its close. Its symbol list, Atlas, keeps every delisted instrument with the day it stopped trading.

Binance BTC-USDT perpetual, the minute from 14:38 UTC on 11 June 2025, from Aperiodic's raw trades: lesson 3's minute.

This lesson is a short version of a course of its own. Building market data, which comes later, is about how market data is built and kept right.

What you learned

Point-in-time
Every record holds only what could be known at its timestamp, and nothing is added, dropped or changed later.
Look-ahead bias
An input stamped earlier than you could have had it lets a backtest trade on the future.
Missing data
Gaps fall where trading is busiest, and they can hide the very moves that hurt.
Survivorship bias
A list of markets made today leaves out the ones that failed, and the losses they caused.

Check yourself

  1. 1. Your signal reads each day's close, but the close was taken an hour after the opening price you buy at. What is wrong with the backtest?

  2. 2. You backtest on the coins an exchange lists today. Which coins are missing?

  3. 3. In the figure, which fault took away the days the stop sold?

Lesson 10 of 10.

All lessons

Your progress stays in this browser. A free account keeps it on any device and lets you pull the data behind these lessons yourself: every metric for 2025 on BTC, ETH, SOL and 10 RWA perps, on an API key of your own. Get the data

Read every lesson on one page

6 min left
  1. Behind the numbers
  2. A backtest on bad data
  3. Three ways data goes wrong
  4. What you learned
  5. Check yourself
Aperiodic

Built from hundreds of terabytes of raw data and distilled into point-in-time metrics you can pull as parquet files. Plus the raw trades, quotes and derivatives data behind them.

Use Cases
  • Improve your backtest
  • Find new alpha
  • Execute smarter
Indices
  • All indices
  • Aperiodic Cost Index
  • Aperiodic Depth Index
  • Aperiodic Impact Index
Metrics
  • Metrics library
  • Data Catalog
  • Free data
  • Live markets dashboard
  • Every perp, A–Z
  • Global Liquidity
  • Unusual activity
  • Order Flow
  • L1 & L2
  • Derivatives
  • RWA
  • Live funding rates
  • Raw Data
Developers
  • Docs
  • API Docs
  • MCP Server
  • Notebooks
  • Integrations
  • For AI Agents
  • Atlas Security Master
  • TParquet
  • Binance OI history API
  • OKX history APIs
  • Pre-flight
  • Changelog
  • Roadmap
  • llms.txt
Learn
  • Markets from First Principles
  • Replays
  • Microstructure Guide
  • Architecture
  • Research Blog
  • FAQ
Compare
  • All vendors
  • Pricing compared
  • vs. Tardis
  • vs. CoinGlass
  • vs. Kaiko
  • vs. Amberdata
  • vs. Crypto Lake
  • vs. Laevitas
  • vs. Coinalyze
  • vs. Binance public data
  • vs. Hyperliquid data
  • Binance archive
  • Hyperliquid data
Company
  • Team
  • Pricing
  • Contact
  • Book a call
  • Terms of Service
  • Privacy Policy
  • Licensing
  • SLA

© Copyright 2026 Aperiodic. All Rights Reserved.

Aperiodic Limited · Registered in Ireland · Company No. 815273 ·
136 Capel Street, Dublin D01 T2C9, Ireland