← All articles

Missing, Late, Wrong: Practical Quality Checks for Market Data

Market data goes bad in three ways: missing, late, or wrong. How to write checks for each, handle failures, and tell readers the truth about the data.

Published

The worst thing about market data isn’t having too little of it. It’s having wrong data that nobody notices. A table can look complete and still be missing a day, arrive half a day late, or have a number in the wrong unit. The people reading it can’t tell. They just have to trust it.

In our own market-data work, we sort common problems into three groups: missing, late, and wrong. Each group has its own checks. Here is how we do it.

Missing: is the data that should be there actually there?

Missing data is the most common problem and the easiest to overlook, because a table with a few rows gone doesn’t throw an error.

Rules we use:

Rule What it checks How it decides
Null rate Whether key fields have empty values Alert when the share of nulls passes a threshold (for example, 5%)
Trading-day continuity Whether any security has gaps in its dates Compare day by day against the trading calendar, looking back 30 days
Daily row count Whether the latest trading day has a normal number of rows Alert when the count falls outside a reasonable range
Duplicate rate Whether one security has several rows for the same day Alert when the share of duplicates passes a threshold

The trading calendar needs checking too. If the calendar only runs to the end of this year, the continuity check silently stops working next year. So once a day we check how many days the calendar has left, and remind someone to extend it when fewer than 30 remain.

There is a sneakier kind of missing data: the downstream job starts before the upstream data is ready. We hit this once. A scheduled job ran before the upstream data had fully arrived and wrote a few hundred records with blank names and every value set to 0. The row count was right. The content was empty.

After that we added a rule: if most rows in a batch are empty records like these, reject the whole batch and log the reason as “upstream data largely missing.” We’d rather have no batch for now than a batch of fake data.

Late: is this today’s data?

Market data has a shelf life. Read yesterday’s data as if it were today’s, and your conclusions will be wrong.

We handle this in two steps:

  1. Define when data should arrive. Each type of data has an expected update time. If it hasn’t updated by then, the freshness check raises an alert.
  2. Put freshness into the data itself. Every time data is returned, it comes with a status:
    • Fresh: the data date is the trading day that was requested.
    • Stale: there is data, but from an earlier date.
    • Missing: there is no data.

The second step matters. A backend alert alone isn’t enough. Every page and API that uses the data should know whether it’s fresh, so it can decide how to show it.

When a collection job fails, it retries automatically, but only up to a limit, such as 3 times. If it still fails after that, a person takes over. It doesn’t retry forever.

Wrong: are the numbers right?

Wrong data is the hardest to catch, because a wrong number looks just like a right one. We use a few kinds of rules:

  • Value ranges. Some values have natural bounds: an index P/E ratio should be positive, and government bond rates should fall within a reasonable range. A value outside the range usually means a unit or source problem.
  • No future dates. A record’s date can’t be later than the time it was collected. “Future” data usually means the date field was parsed wrong.
  • Calculation consistency. If a metric comes from a formula, run the formula backward and check that the parts add up to the total.
  • No look-ahead. When computing a historical percentile, use only data that existed at that time, not data that came later. Skip this check and historical results look unrealistically good.
  • Reconciliation. If the same data is stored in two places, compare them once a day to make sure they match.

Take valuation metrics as an example: the index valuation, the government bond rate, the date, the formula, and the percentile each have their own check.

How to tell readers when something is wrong

The point of all these checks is to let the people reading the data know whether they can trust it. A few practices:

  • Label every number with its data date. Show a “data date” on the page and return a date field in the API. When there is no data, show “—”. Don’t leave it blank and don’t fill in 0.
  • Say exactly what is missing. “Tick data for a given trading day is missing” is far more useful than a generic “failed to load.”
  • Never pass old data off as new. When data is stale, label it “stale” instead of quietly showing the previous day’s numbers.
  • Give alerts severity levels. Use two levels, “warning” and “error.” Each alert carries the rule ID, the actual value, and the threshold, so whoever handles it can see the problem at a glance.

Summary

There is no data quality rulebook you write once and are done with. What has worked for us: start with a few rules for the most common problems in each group (missing, late, wrong). Then, every time something breaks, add a rule that would have caught it.

The rules run in the backend, but the results need to reach the front end. People reading the data should be able to see the data date, how fresh it is, and what is missing.

FAQ

What should you do when a data check fails?

Don’t write that batch into the tables users see. If you can wait for the upstream source to fill the gap, wait. If you must show something, label the data date and what is missing. Never pass old data off as new.

How many data quality rules are enough?

Start with a few rules for the most common problems in each of the three groups (missing, late, wrong), such as null rate, trading-day continuity, on-time updates, and value ranges. Every time something breaks, add a rule that would have caught it.